Search in sources :

Example 86 with JargonException

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;
}
Also used : IRODSFileFactory(org.irods.jargon.core.pub.io.IRODSFileFactory) CollectionAO(org.irods.jargon.core.pub.CollectionAO) JargonException(org.irods.jargon.core.exception.JargonException) DataObjectAO(org.irods.jargon.core.pub.DataObjectAO) IRODSFile(org.irods.jargon.core.pub.io.IRODSFile)

Aggregations

JargonException (org.irods.jargon.core.exception.JargonException)86 DataGridCollectionAndDataObject (com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)20 CollectionAO (org.irods.jargon.core.pub.CollectionAO)20 DataGridException (com.emc.metalnx.core.domain.exceptions.DataGridException)18 DataObjectAO (org.irods.jargon.core.pub.DataObjectAO)18 IRODSFile (org.irods.jargon.core.pub.io.IRODSFile)17 IRODSFileFactory (org.irods.jargon.core.pub.io.IRODSFileFactory)15 ArrayList (java.util.ArrayList)12 SpecificQueryAO (org.irods.jargon.core.pub.SpecificQueryAO)12 DataGridConnectionRefusedException (com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException)11 CollectionAndDataObjectListAndSearchAO (org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO)10 SpecificQueryDefinition (org.irods.jargon.core.pub.domain.SpecificQueryDefinition)10 SpecificQueryResultSet (org.irods.jargon.core.query.SpecificQueryResultSet)9 UnsupportedDataGridFeatureException (com.emc.metalnx.core.domain.exceptions.UnsupportedDataGridFeatureException)8 SpecificQueryProvider (com.emc.metalnx.services.irods.utils.SpecificQueryProvider)8 ClientHints (org.irods.jargon.core.pub.domain.ClientHints)8 DataObject (org.irods.jargon.core.pub.domain.DataObject)8 CollectionAndDataObjectListingEntry (org.irods.jargon.core.query.CollectionAndDataObjectListingEntry)8 SpecificQuery (org.irods.jargon.core.query.SpecificQuery)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)8