|
|
|
@ -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;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|