git-svn-id: https://svn.d4science-ii.research-infrastructures.eu/gcube/branches/data-access/storagehub-webapp/1.0@179622 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
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;
|
||||
|
@ -113,6 +114,7 @@ public class ACLManager {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a new AccessType for a user in a shared folder
|
||||
*
|
||||
|
@ -193,4 +195,32 @@ 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…
Reference in New Issue