diff --git a/src/main/java/org/gcube/gcat/rest/administration/User.java b/src/main/java/org/gcube/gcat/rest/administration/User.java index 2d623b6..24f3f0d 100644 --- a/src/main/java/org/gcube/gcat/rest/administration/User.java +++ b/src/main/java/org/gcube/gcat/rest/administration/User.java @@ -158,7 +158,8 @@ public class User extends REST implements org.gcube.gcat.api.interface public Response removeUserFromCache(@PathParam(GCUBE_USERNAME_PARAMETER) String username) { SecretManager secretManager = SecretManagerProvider.instance.get(); org.gcube.common.authorization.utils.user.User user = secretManager.getUser(); - if(user.getRoles().contains(Role.MANAGER.getPortalRole())) { + if(user.getRoles().contains(Role.MANAGER.getPortalRole()) || user.getUsername().compareToIgnoreCase(username)==0) { + // Any user can remove self from cache CKANUserCache.removeUserFromCache(username); }else { throw new ForbiddenException("Only " + Role.MANAGER.getPortalRole() + "s are authorized to remove an user from the cache");