use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.
the class UserServiceImpl method updateOwnership.
@Override
public boolean updateOwnership(DataGridUser user, Map<String, Boolean> addCollectionsToOwn, Map<String, Boolean> removeCollectionsToOwn) throws DataGridConnectionRefusedException {
CollectionAO collectionAO = null;
DataObjectAO dataObjectAO = null;
IRODSFile irodsFile = null;
IRODSFileFactory irodsFileFactory = null;
boolean ownPermissionsUpdated = false;
try {
collectionAO = irodsServices.getCollectionAO();
dataObjectAO = irodsServices.getDataObjectAO();
irodsFileFactory = irodsServices.getIRODSFileFactory();
for (String path : addCollectionsToOwn.keySet()) {
irodsFile = irodsFileFactory.instanceIRODSFile(path);
if (irodsFile.isDirectory()) {
collectionAO.setAccessPermissionOwnAsAdmin(user.getAdditionalInfo(), path, user.getUsername(), addCollectionsToOwn.get(path));
} else {
dataObjectAO.setAccessPermissionOwnInAdminMode(user.getAdditionalInfo(), path, user.getUsername());
}
}
removeAccessPermissionForUserAsAdmin(user, removeCollectionsToOwn);
ownPermissionsUpdated = true;
} catch (JargonException e) {
logger.error("Could not set ownership permission:", e);
}
return ownPermissionsUpdated;
}
Aggregations