Any user can remove self from cache

This commit is contained in:
Luca Frosini 2023-01-26 10:30:22 +01:00
parent b48a497c30
commit 4e015d5a44
1 changed files with 6 additions and 5 deletions

View File

@ -143,11 +143,12 @@ public class User extends REST<CKANUser> implements org.gcube.gcat.api.interface
public Response removeCallerFromCache() { public Response removeCallerFromCache() {
SecretManager secretManager = SecretManagerProvider.instance.get(); SecretManager secretManager = SecretManagerProvider.instance.get();
org.gcube.common.authorization.utils.user.User user = secretManager.getUser(); org.gcube.common.authorization.utils.user.User user = secretManager.getUser();
if(user.getRoles().contains(Role.MANAGER.getPortalRole())) { // if(user.getRoles().contains(Role.MANAGER.getPortalRole())) {
CKANUserCache.removeUserFromCache(); // Any user can remove self from cache
}else { CKANUserCache.removeUserFromCache();
throw new ForbiddenException("Only " + Role.MANAGER.getPortalRole() + "s are authorized to remove an user from the cache"); // }else {
} // throw new ForbiddenException("Only " + Role.MANAGER.getPortalRole() + "s are authorized to remove an user from the cache");
// }
return Response.status(Status.NO_CONTENT).build(); return Response.status(Status.NO_CONTENT).build();
} }