Search in sources :

Example 21 with CollectionAO

use of org.irods.jargon.core.pub.CollectionAO in project metalnx-web by irods-contrib.

the class UserServiceImpl method updateWritePermissions.

@Override
public boolean updateWritePermissions(DataGridUser user, Map<String, Boolean> addCollectionsToWrite, Map<String, Boolean> removeCollectionsToWrite) throws DataGridConnectionRefusedException {
    CollectionAO collectionAO = null;
    DataObjectAO dataObjectAO = null;
    IRODSFile irodsFile = null;
    IRODSFileFactory irodsFileFactory = null;
    boolean writePermissionsUpdated = false;
    try {
        collectionAO = irodsServices.getCollectionAO();
        dataObjectAO = irodsServices.getDataObjectAO();
        irodsFileFactory = irodsServices.getIRODSFileFactory();
        for (String path : addCollectionsToWrite.keySet()) {
            irodsFile = irodsFileFactory.instanceIRODSFile(path);
            if (irodsFile.isDirectory()) {
                collectionAO.setAccessPermissionWriteAsAdmin(user.getAdditionalInfo(), path, user.getUsername(), addCollectionsToWrite.get(path));
            } else {
                dataObjectAO.setAccessPermissionWriteInAdminMode(user.getAdditionalInfo(), path, user.getUsername());
            }
        }
        removeAccessPermissionForUserAsAdmin(user, removeCollectionsToWrite);
        writePermissionsUpdated = true;
    } catch (JargonException e) {
        logger.error("Could not set write permission:", e);
    }
    return writePermissionsUpdated;
}
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)

Example 22 with CollectionAO

use of org.irods.jargon.core.pub.CollectionAO 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

CollectionAO (org.irods.jargon.core.pub.CollectionAO)22 JargonException (org.irods.jargon.core.exception.JargonException)20 DataObjectAO (org.irods.jargon.core.pub.DataObjectAO)14 DataGridCollectionAndDataObject (com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)7 IRODSFile (org.irods.jargon.core.pub.io.IRODSFile)7 IRODSFileFactory (org.irods.jargon.core.pub.io.IRODSFileFactory)7 CollectionAndDataObjectListAndSearchAO (org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO)5 DataObject (org.irods.jargon.core.pub.domain.DataObject)5 DataGridException (com.emc.metalnx.core.domain.exceptions.DataGridException)4 HashSet (java.util.HashSet)3 AvuData (org.irods.jargon.core.pub.domain.AvuData)3 FileNotFoundException (org.irods.jargon.core.exception.FileNotFoundException)2 FilePermissionEnum (org.irods.jargon.core.protovalues.FilePermissionEnum)2 IRODSFileSystemAO (org.irods.jargon.core.pub.IRODSFileSystemAO)2 DataGridMetadata (com.emc.metalnx.core.domain.entity.DataGridMetadata)1 IconObject (com.emc.metalnx.core.domain.entity.IconObject)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 IRODSAccount (org.irods.jargon.core.connection.IRODSAccount)1 DataTransferOperations (org.irods.jargon.core.pub.DataTransferOperations)1