Added possibility to read the user by gcube username
This commit is contained in:
parent
cf150065d0
commit
cfa089131a
|
@ -65,7 +65,12 @@ public class CKANUser extends CKAN {
|
||||||
catalogueModerator = null;
|
catalogueModerator = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String create() {
|
public void setName(String name) {
|
||||||
|
name = getCKANUsername(name);
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String createInCkan() {
|
||||||
RandomString randomString = new RandomString(12);
|
RandomString randomString = new RandomString(12);
|
||||||
ObjectNode objectNode = mapper.createObjectNode();
|
ObjectNode objectNode = mapper.createObjectNode();
|
||||||
objectNode.put(NAME, name);
|
objectNode.put(NAME, name);
|
||||||
|
@ -173,7 +178,7 @@ public class CKANUser extends CKAN {
|
||||||
updateProfileIfNeeded();
|
updateProfileIfNeeded();
|
||||||
} catch(WebApplicationException e) {
|
} catch(WebApplicationException e) {
|
||||||
if(e.getResponse().getStatusInfo() == Status.NOT_FOUND) {
|
if(e.getResponse().getStatusInfo() == Status.NOT_FOUND) {
|
||||||
create();
|
createInCkan();
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,9 @@ public class User extends REST<CKANUser> implements org.gcube.gcat.api.interface
|
||||||
* The service add the user's role in <code>portal_role</code> property when the user read its own profile.
|
* The service add the user's role in <code>portal_role</code> property when the user read its own profile.
|
||||||
* See <a href="../docs/index.html#roles">Roles</a> section for more information.
|
* See <a href="../docs/index.html#roles">Roles</a> section for more information.
|
||||||
*
|
*
|
||||||
* @pathExample /users/luca_frosini
|
* @param username Ckan or gcube username are both accepted
|
||||||
|
*
|
||||||
|
* @pathExample /users/luca.frosini
|
||||||
* @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/user/read-user-response.json
|
* @responseExample application/json;charset=UTF-8 classpath:/api-docs-examples/user/read-user-response.json
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
|
|
Loading…
Reference in New Issue