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() {
SecretManager secretManager = SecretManagerProvider.instance.get();
org.gcube.common.authorization.utils.user.User user = secretManager.getUser();
if(user.getRoles().contains(Role.MANAGER.getPortalRole())) {
CKANUserCache.removeUserFromCache();
}else {
throw new ForbiddenException("Only " + Role.MANAGER.getPortalRole() + "s are authorized to remove an user from the cache");
}
// if(user.getRoles().contains(Role.MANAGER.getPortalRole())) {
// Any user can remove self from cache
CKANUserCache.removeUserFromCache();
// }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();
}