Added possibility to read the user by gcube username

migrating_to_smartgears_4
Luca Frosini 2 years ago
parent cf150065d0
commit cfa089131a

@ -65,7 +65,12 @@ public class CKANUser extends CKAN {
catalogueModerator = null;
}
public String create() {
public void setName(String name) {
name = getCKANUsername(name);
this.name = name;
}
public String createInCkan() {
RandomString randomString = new RandomString(12);
ObjectNode objectNode = mapper.createObjectNode();
objectNode.put(NAME, name);
@ -173,7 +178,7 @@ public class CKANUser extends CKAN {
updateProfileIfNeeded();
} catch(WebApplicationException e) {
if(e.getResponse().getStatusInfo() == Status.NOT_FOUND) {
create();
createInCkan();
} else {
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.
* 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
*/
@GET

Loading…
Cancel
Save