Skip to content

Commit

Permalink
#15 allow groupadmin to be a role in metalnx
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed Nov 20, 2019
1 parent c97aaa4 commit 50270d4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ private AuthResponse authenticateAgainstIRODS(String username, String password,

// If the user is found
if (irodsUser.getUserType().equals(UserTypeEnum.RODS_ADMIN)
|| irodsUser.getUserType().equals(UserTypeEnum.GROUP_ADMIN)
|| irodsUser.getUserType().equals(UserTypeEnum.RODS_USER)) {

// If the user is not yet persisted in our database
Expand All @@ -207,6 +208,9 @@ private AuthResponse authenticateAgainstIRODS(String username, String password,
if (irodsUser.getUserType().equals(UserTypeEnum.RODS_ADMIN)) {
logger.debug("setting user type admin:{}", irodsUser.getUserType());
user.setUserType(UserTypeEnum.RODS_ADMIN.getTextValue());
} else if (irodsUser.getUserType().equals(UserTypeEnum.GROUP_ADMIN)) {
logger.debug("setting user type groupadmin:{}", irodsUser.getUserType());
user.setUserType(UserTypeEnum.GROUP_ADMIN.getTextValue());
} else {
logger.debug("setting user type rodsuser:{}", irodsUser.getUserType());
user.setUserType(UserTypeEnum.RODS_USER.getTextValue());
Expand Down Expand Up @@ -293,6 +297,8 @@ public String getAuthority() {
*/
private class IRODSGroupadminGrantedAuthority implements GrantedAuthority {

private static final long serialVersionUID = 1L;

@Override
public String getAuthority() {
return "ROLE_GROUPADMIN";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public boolean deleteUserByUsername(String username) throws DataGridConnectionRe
}

@Override
public boolean modifyUser(DataGridUser modifyUser) throws DataGridConnectionRefusedException {
public boolean modifyUser(DataGridUser modifyUser) throws DataGridException {

UserAO userAO = irodsServices.getUserAO();

Expand Down Expand Up @@ -249,9 +249,9 @@ public boolean modifyUser(DataGridUser modifyUser) throws DataGridConnectionRefu

return true;
} catch (JargonException e) {
e.printStackTrace();
logger.error("error modifying user:{}", modifyUser, e);
throw new DataGridException("unable to modify user", e);
}
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ public boolean createUser(DataGridUser user, String password)
/**
* Modify user by username
*
* @param username
* @param modifyUser {@link DataGridUser} to be modified
* @return a confirmation that the user has been modified
* @throws DataGridConnectionRefusedException
* @throws DataGridException {@link DataGridException}
*/
public boolean modifyUser(DataGridUser modifyUser) throws DataGridConnectionRefusedException;
public boolean modifyUser(DataGridUser modifyUser) throws DataGridException;

/**
* Finds users by username
Expand Down

0 comments on commit 50270d4

Please sign in to comment.