From 4802a0542e5685868ff75f67055c578d66697245 Mon Sep 17 00:00:00 2001 From: lucio Date: Tue, 7 Jan 2020 17:05:51 +0100 Subject: [PATCH] Corrected a Authorization message error --- pom.xml | 5 ----- .../access/storagehub/AuthorizationChecker.java | 14 +++++++------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 3aa3b2d..1c29013 100644 --- a/pom.xml +++ b/pom.xml @@ -97,11 +97,6 @@ common-scope - - org.gcube.core - common-encryption - - org.gcube.common storagehub-model diff --git a/src/main/java/org/gcube/data/access/storagehub/AuthorizationChecker.java b/src/main/java/org/gcube/data/access/storagehub/AuthorizationChecker.java index ad792be..a294964 100644 --- a/src/main/java/org/gcube/data/access/storagehub/AuthorizationChecker.java +++ b/src/main/java/org/gcube/data/access/storagehub/AuthorizationChecker.java @@ -44,7 +44,7 @@ public class AuthorizationChecker { Item item = node2Item.getItem(node, Excludes.ALL); - if (item==null) throw new UserNotAuthorizedException("Insufficent Provileges for user "+login+" to read node with id "+id+": it's not a valid StorageHub node"); + if (item==null) throw new UserNotAuthorizedException("Insufficent Privileges for user "+login+" to read node with id "+id+": it's not a valid StorageHub node"); @@ -64,10 +64,10 @@ public class AuthorizationChecker { if (!authorizable.isGroup() && entry.getPrincipal().getName().equals(login)) return; if (authorizable.isGroup() && ((Group) authorizable).isMember(userAuthorizable)) return; } - throw new UserNotAuthorizedException("Insufficent Provileges for user "+login+" to read node with id "+id); + throw new UserNotAuthorizedException("Insufficent Privileges for user "+login+" to read node with id "+id); } else if (item.getOwner()==null || !item.getOwner().equals(login)) - throw new UserNotAuthorizedException("Insufficent Provileges for user "+login+" to read node with id "+id); + throw new UserNotAuthorizedException("Insufficent Privileges for user "+login+" to read node with id "+id); } @@ -86,10 +86,10 @@ public class AuthorizationChecker { String login = AuthorizationProvider.instance.get().getClient().getId(); - if (item==null) throw new UserNotAuthorizedException("Insufficent Provileges for user "+login+" to write into node with id "+id+": it's not a valid StorageHub node"); + if (item==null) throw new UserNotAuthorizedException("Insufficent Privileges for user "+login+" to write into node with id "+id+": it's not a valid StorageHub node"); if (Constants.WRITE_PROTECTED_FOLDER.contains(item.getName()) || Constants.WRITE_PROTECTED_FOLDER.contains(item.getTitle())) - throw new UserNotAuthorizedException("Insufficent Provileges for user "+login+" to write into node with id "+id+": it's a protected folder"); + throw new UserNotAuthorizedException("Insufficent Privileges for user "+login+" to write into node with id "+id+": it's a protected folder"); if (item.isShared()) { Node parentSharedNode = retrieveSharedFolderParent(node, session); @@ -116,7 +116,7 @@ public class AuthorizationChecker { } else if(item.getOwner().equals(login)) return; - throw new UserNotAuthorizedException("Insufficent Provileges for user "+login+" to write into node with id "+id); + throw new UserNotAuthorizedException("Insufficent Privileges for user "+login+" to write into node with id "+id); } @@ -132,7 +132,7 @@ public class AuthorizationChecker { //TODO: riguardare questo pezzo di codice String login = AuthorizationProvider.instance.get().getClient().getId(); - if (item==null) throw new UserNotAuthorizedException("Insufficent Provileges for user "+login+": it's not a valid StorageHub node"); + if (item==null) throw new UserNotAuthorizedException("Insufficent Privileges for user "+login+": it's not a valid StorageHub node"); Node node = session.getNodeByIdentifier(item.getId());