Skip to content
Permalink
Browse files
FC-239 - implement ReviewMgl.assignedUsers roleConstraints
  • Loading branch information
shawnmckinney committed Aug 28, 2018
1 parent 0117a48 commit 8b3c27f76f60640cb11f34d65ac6a0604c5214c2
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
@@ -2748,6 +2748,40 @@
FortResponse assignedUsers( FortRequest request );


/**
* This method returns the data set of all users who are assigned the given role constraint. This searches the User data set for
* RoleConstraint relationship. This method does NOT search for hierarchical RBAC Roles relationships.
* <h3></h3>
* <h4>required parameters</h4>
* <ul>
* <li>
* {@link FortRequest#entity} - contains a reference to {@link org.apache.directory.fortress.core.model.RoleConstraint} entity
* </li>
* </ul>
* <ul style="list-style-type:none">
* <li>
* <ul style="list-style-type:none">
* <li>
* <h5>{@link org.apache.directory.fortress.core.model.RoleConstraint} required parameters</h5>
* <ul>
* <li>
* {@link org.apache.directory.fortress.core.model.RoleConstraint#key} - contains the name to use for the Role
* {@link org.apache.directory.fortress.core.model.RoleConstraint#value} - contains the name to use for the Role
* targeted for search.
* </li>
* </ul>
* </li>
* </ul>
* </li>
* </ul>
*
* @param request contains a reference to {@code FortRequest}
* @return reference to {@code FortResponse}, {@link FortResponse#entities} contains a reference to a List of type
* {@link org.apache.directory.fortress.core.model.User}
*/
FortResponse assignedUsersConstraints( FortRequest request );


/**
* This function returns the set of roles assigned to a given user. The function is valid if and
* only if the user is a member of the USERS data set.
@@ -812,6 +812,19 @@ public FortResponse assignedUsers( FortRequest request )
}


/**
* {@inheritDoc}
*/
@POST
@Path("/" + HttpIds.USER_ASGNED_CONSTRAINTS + "/")
@RolesAllowed({SUPER_USER, REVIEW_MGR_USER})
@Override
public FortResponse assignedUsersConstraints( FortRequest request )
{
return reviewMgrImpl.assignedUsersConstraints( request );
}


/**
* {@inheritDoc}
*/
@@ -316,7 +316,6 @@ class ReviewMgrImpl extends AbstractMgrImpl
{
List<User> users = reviewMgr.assignedUsers( inRole );
response.setEntities( users );
response.setEntities( users );
}
}
catch ( SecurityException se )
@@ -328,6 +327,28 @@ class ReviewMgrImpl extends AbstractMgrImpl
}


/* No qualifier */ FortResponse assignedUsersConstraints( FortRequest request )
{
FortResponse response = createResponse();

try
{
ReviewMgr reviewMgr = ReviewMgrFactory.createInstance( request.getContextId() );
reviewMgr.setAdmin( request.getSession() );
Role inRole = (Role) request.getEntity();
RoleConstraint inConstraint = (RoleConstraint) request.getEntity2();
List<User> users = reviewMgr.assignedUsers( inRole, inConstraint );
response.setEntities( users );
}
catch ( SecurityException se )
{
createError( response, LOG, se );
}

return response;
}


/* No qualifier */ FortResponse assignedRolesM( FortRequest request )
{
FortResponse response = createResponse();

0 comments on commit 8b3c27f

Please sign in to comment.