Lucio Lelii 5 years ago
parent a339d2c16c
commit 7dd3ec6efb

@ -34,6 +34,7 @@ import org.gcube.common.storagehub.model.exceptions.BackendGenericError;
import org.gcube.common.storagehub.model.exceptions.InvalidCallParameters;
import org.gcube.common.storagehub.model.exceptions.InvalidItemException;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
import org.gcube.common.storagehub.model.exceptions.UserNotAuthorizedException;
import org.gcube.common.storagehub.model.items.Item;
import org.gcube.common.storagehub.model.items.SharedFolder;
import org.gcube.common.storagehub.model.types.ACLList;
@ -112,7 +113,8 @@ public class ACLManager {
return new ACLList(acls);
}
/**
* Set a new AccessType for a user in a shared folder
*
@ -192,5 +194,33 @@ public class ACLManager {
}
}
@GET
@Path("{id}/acls/user/{user}/canwrite")
public Boolean checkAccess(@PathParam("user") String user) {
InnerMethodName.instance.set("checkAccess");
Session ses = null;
Boolean canWrite = false;
try{
try {
authChecker.checkWriteAuthorizationControl(ses, id, true);
}catch (UserNotAuthorizedException e) {
return false;
}
return true;
}catch(RepositoryException re){
log.error("jcr error getting acl", re);
GXOutboundErrorResponse.throwException(new BackendGenericError("jcr error getting acl", re));
}catch(StorageHubException she ){
log.error(she.getErrorMessage(), she);
GXOutboundErrorResponse.throwException(she, Response.Status.fromStatusCode(she.getStatus()));
}finally{
if (ses!=null)
ses.logout();
}
return canWrite;
}
}

@ -25,7 +25,7 @@ no. 654119), SoBigData (grant no. 654024), AGINFRA PLUS (grant no. 731001).
Version
--------------------------------------------------
1.0.5-SNAPSHOT (2019-05-06)
1.0.5-SNAPSHOT (2019-05-29)
Please see the file named "changelog.xml" in this directory for the release notes.

@ -10,7 +10,7 @@
</context-param>
<context-param>
<param-name>resolver-basepath</param-name>
<param-value>https://data1-d.d4science.org/shub</param-value>
<param-value>https://data-pre.d4science.org/shub</param-value>
</context-param>
<servlet>
<servlet-name>org.gcube.data.access.storagehub.StorageHub</servlet-name>

Loading…
Cancel
Save