Skip to content

Commit

Permalink
#235 fix user groups for cloud browser queries
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed Mar 17, 2017
1 parent df3423e commit 6512822
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ Fix save of string to file (in Stream2StreamAO) to not delete a file when overwr
#### Add list user groups like x method #233

Enhanced user group and user queries for cloud browser

#### add col user type to genquery #235

Add user type to LIKE queries to discriminate users from groups in find 'like' queries
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ IRODSFile instanceIRODSFileForCollectionPath(String collectionPath)
*/
List<Collection> findDomainByMetadataQuery(
List<AVUQueryElement> avuQueryElements)
throws JargonQueryException, JargonException;
throws JargonQueryException, JargonException;

/**
* Given a set of metadata query parameters, return a list of IRODS
Expand Down Expand Up @@ -120,7 +120,7 @@ List<Collection> findDomainByMetadataQuery(
*/
List<MetaDataAndDomainData> findMetadataValuesByMetadataQuery(
List<AVUQueryElement> avuQuery, int offset)
throws JargonQueryException, JargonException;
throws JargonQueryException, JargonException;

/**
* Get a summary list of collections and data objects and AVU metadata based
Expand Down Expand Up @@ -159,7 +159,7 @@ List<MetaDataAndDomainData> findMetadataValuesByMetadataQuery(
*/
List<MetaDataAndDomainData> findMetadataValuesByMetadataQuery(
List<AVUQueryElement> avuQuery, boolean caseInsensitive)
throws JargonQueryException, JargonException;
throws JargonQueryException, JargonException;

/**
* Get a list of collections and associated metadata that match a given AVU
Expand All @@ -182,7 +182,7 @@ List<MetaDataAndDomainData> findMetadataValuesByMetadataQuery(
*/
List<MetaDataAndDomainData> findMetadataValuesByMetadataQuery(
List<AVUQueryElement> avuQuery, int offset, boolean caseInsensitive)
throws JargonQueryException, JargonException;
throws JargonQueryException, JargonException;

/**
* Add AVU metadata for this collection. *
Expand Down Expand Up @@ -289,7 +289,7 @@ List<MetaDataAndDomainData> findMetadataValuesByMetadataQueryForCollection(
List<MetaDataAndDomainData> findMetadataValuesByMetadataQueryForCollection(
List<AVUQueryElement> avuQuery, String collectionAbsolutePath,
int partialStartIndex, boolean caseInsensitive)
throws FileNotFoundException, JargonQueryException, JargonException;
throws FileNotFoundException, JargonQueryException, JargonException;

/**
* Get a list of the metadata values for the given collection absolute path.
Expand Down Expand Up @@ -320,7 +320,7 @@ List<MetaDataAndDomainData> findMetadataValuesByMetadataQueryForCollection(
*/
List<MetaDataAndDomainData> findMetadataValuesForCollection(
final String collectionAbsolutePath, final int partialStartIndex)
throws FileNotFoundException, JargonException, JargonQueryException;
throws FileNotFoundException, JargonException, JargonQueryException;

/**
* Get a list of the metadata values for the given collection absolute path.
Expand Down Expand Up @@ -403,7 +403,7 @@ Collection findByAbsolutePath(final String irodsCollectionAbsolutePath)
List<MetaDataAndDomainData> findMetadataValuesByMetadataQueryForCollection(
final List<AVUQueryElement> avuQuery,
final String collectionAbsolutePath, final int partialStartIndex)
throws JargonQueryException, JargonException;
throws JargonQueryException, JargonException;

/**
* For a given iRODS collection, give a count of the total number of data
Expand All @@ -424,7 +424,7 @@ List<MetaDataAndDomainData> findMetadataValuesByMetadataQueryForCollection(
*/
int countAllFilesUnderneathTheGivenCollection(
final String irodsCollectionAbsolutePath)
throws FileNotFoundException, JargonException;
throws FileNotFoundException, JargonException;

/**
* For a given iRODS collection, set the access permission to read. This can
Expand Down Expand Up @@ -702,7 +702,7 @@ void modifyAvuValueBasedOnGivenAttributeAndUnit(String absolutePath,
*/
UserFilePermission getPermissionForUserName(
String irodsCollectionAbsolutePath, String userName)
throws JargonException;
throws JargonException;

/**
* For a given iRODS collection, set the access permission to read as an
Expand Down Expand Up @@ -828,7 +828,7 @@ void removeAccessPermissionForUserAsAdmin(String zone, String absolutePath,
* @throws JargonException
*/
Collection findGivenObjStat(ObjStat objStat) throws DataNotFoundException,
JargonException;
JargonException;

/**
* Method to set access permission to the desired state, this variant makes
Expand Down Expand Up @@ -862,7 +862,7 @@ Collection findGivenObjStat(ObjStat objStat) throws DataNotFoundException,
*/
void setAccessPermission(String zone, String absolutePath, String userName,
boolean recursive, FilePermissionEnum filePermission)
throws JargonException;
throws JargonException;

/**
* Find the iRODS <code>Collection</code> with the given primary key in the
Expand Down Expand Up @@ -914,7 +914,7 @@ void replicateCollectionAsynchronously(String irodsCollectionAbsolutePath,
*/
List<BulkAVUOperationResponse> addBulkAVUMetadataToCollection(
String absolutePath, List<AvuData> avuData)
throws FileNotFoundException, JargonException;
throws FileNotFoundException, JargonException;

/**
* Convenience method to delete a set of AVU metadata. This operation is
Expand Down Expand Up @@ -967,8 +967,8 @@ void deleteAllAVUMetadata(String absolutePath)
*/
MetaDataAndDomainData findMetadataValueForCollectionByMetadataId(
String collectionAbsolutePath, int id)
throws FileNotFoundException, DataNotFoundException,
JargonException;
throws FileNotFoundException, DataNotFoundException,
JargonException;

/**
* Query for a specific AVU associated with the collection based on the
Expand Down Expand Up @@ -1009,7 +1009,7 @@ void setAccessPermissionToNotInheritInAdminMode(String zone,
String absolutePath, boolean recursive) throws JargonException;

/**
* For a given iRODS collection, set he default to inherit access
* For a given iRODS collection, set the default to inherit access
* permissions, using admin mode.
* <p/>
* Note that this method will work if a soft-linked collection name is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public final class UserAOImpl extends IRODSGenericAO implements UserAO {
private static final String AND = " AND ";
private static final String EQUALS = " = ";
private static final String STRING_TO_HASH_WITH = "stringToHashWith";

private static final String RODS_GROUP = "rodsgroup";
private IRODSGenQueryExecutor irodsGenQueryExecutor = null;

protected UserAOImpl(final IRODSSession irodsSession,
Expand Down Expand Up @@ -536,6 +538,9 @@ public List<String> findUserNameLike(final String userName)
OrderByType.ASC)
.addOrderByGenQueryField(RodsGenQueryEnum.COL_USER_ZONE,
OrderByType.ASC)
.addConditionAsGenQueryField(
RodsGenQueryEnum.COL_USER_TYPE,
QueryConditionOperators.NOT_EQUAL, RODS_GROUP)
.addConditionAsGenQueryField(
RodsGenQueryEnum.COL_USER_NAME,
QueryConditionOperators.LIKE,
Expand Down Expand Up @@ -592,6 +597,9 @@ public List<User> findUsersLike(final String userName)
OrderByType.ASC)
.addOrderByGenQueryField(RodsGenQueryEnum.COL_USER_ZONE,
OrderByType.ASC)
.addConditionAsGenQueryField(
RodsGenQueryEnum.COL_USER_TYPE,
QueryConditionOperators.NOT_EQUAL, RODS_GROUP)
.addConditionAsGenQueryField(
RodsGenQueryEnum.COL_USER_NAME,
QueryConditionOperators.LIKE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public final class UserGroupAOImpl extends IRODSGenericAO implements

private final Logger log = LoggerFactory.getLogger(this.getClass());
private static final char COMMA = ',';
private static final String RODS_GROUP = "rodsgroup";
private IRODSGenQueryExecutor irodsGenQueryExecutor = null;

/**
Expand Down Expand Up @@ -475,10 +476,12 @@ public List<UserGroup> findUserGroups(final String userGroupName)
sb.append(userGroupName.trim());
sb.append('%');

builder.addConditionAsGenQueryField(
RodsGenQueryEnum.COL_USER_GROUP_NAME,
QueryConditionOperators.LIKE, sb.toString());
builder

.addConditionAsGenQueryField(RodsGenQueryEnum.COL_USER_GROUP_NAME,
QueryConditionOperators.LIKE, sb.toString())
.addConditionAsGenQueryField(RodsGenQueryEnum.COL_USER_TYPE,
QueryConditionOperators.EQUAL, RODS_GROUP);
IRODSQueryResultSet resultSet = null;
try {
IRODSGenQueryFromBuilder irodsQuery = builder
Expand Down

0 comments on commit 6512822

Please sign in to comment.