Class DefaultRoleService
- java.lang.Object
-
- org.apache.archiva.redback.rest.services.v2.BaseRedbackService
-
- org.apache.archiva.redback.rest.services.v2.DefaultRoleService
-
- All Implemented Interfaces:
RoleService
@Service("v2.roleService#rest") public class DefaultRoleService extends BaseRedbackService implements RoleService- Since:
- 1.3
- Author:
- Olivier Lamy
-
-
Field Summary
-
Fields inherited from class org.apache.archiva.redback.rest.services.v2.BaseRedbackService
rbacManager, USER_FILTER_MAP, USER_ORDER_MAP, USER_QUERY_HELPER, userManager
-
-
Constructor Summary
Constructors Constructor Description DefaultRoleService(RoleManager roleManager, RBACManager rbacManager, UserManager userManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RoleInfoassignRole(String roleId, String userId)Assigns the role indicated by the roleId to the given principalRoleInfoassignTemplatedRole(String templateId, String resource, String userId)Assigns the templated role indicated by the templateId fails if the templated role has not been createdjavax.ws.rs.core.ResponsecheckRole(String roleId)javax.ws.rs.core.ResponsecheckTemplateRole(String templateId, String resource)RoleInfocreateTemplatedRole(String templateId, String resource)RoleInfodeleteRoleAssignment(String roleId, String userId)Deletes the assignment of a role to a user.org.apache.archiva.components.rest.model.PagedResult<RoleInfo>getAllRoles(String searchTerm, Integer offset, Integer limit, List<String> orderBy, String order)RoleInfogetRole(String roleId)org.apache.archiva.components.rest.model.PagedResult<UserInfo>getRoleUsers(String roleId, String recurse, String searchTerm, Integer offset, Integer limit, List<String> orderBy, String order)This returns the list of assigned users to a given role.List<RoleTemplate>getTemplates()org.apache.archiva.components.rest.model.PagedResult<UserInfo>getUnassignedUsers(String roleId, String recurse, String searchTerm, Integer offset, Integer limit, List<String> orderBy, String order)RoleInfomoveTemplatedRole(String templateId, String oldResource, String newResource)Moves a templated role from one resource to another resourcejavax.ws.rs.core.ResponseremoveTemplatedRole(String templateId, String resource)Removes a role corresponding to the role Id that was manufactured with the given resource it also removes any user assignments for that roleRoleInfoupdateRole(String roleId, Role role)Updates a role.-
Methods inherited from class org.apache.archiva.redback.rest.services.v2.BaseRedbackService
getAssignedRedbackUsers, getAssignedRedbackUsersRecursive, getAssignedUsersRecursive, getChildRoles, getParentRoles, getRedbackUser, getRestUser, getRoleInfo, getRoleInfoOptional, getUserInfoPagedResult, isAscending
-
-
-
-
Constructor Detail
-
DefaultRoleService
@Inject public DefaultRoleService(RoleManager roleManager, @Named("rbacManager#default") RBACManager rbacManager, @Named("userManager#default") UserManager userManager)
-
-
Method Detail
-
getAllRoles
public org.apache.archiva.components.rest.model.PagedResult<RoleInfo> getAllRoles(String searchTerm, Integer offset, Integer limit, List<String> orderBy, String order) throws RedbackServiceException
- Specified by:
getAllRolesin interfaceRoleService- Throws:
RedbackServiceException
-
getRole
public RoleInfo getRole(String roleId) throws RedbackServiceException
- Specified by:
getRolein interfaceRoleService- Throws:
RedbackServiceException
-
checkRole
public javax.ws.rs.core.Response checkRole(String roleId) throws RedbackServiceException
- Specified by:
checkRolein interfaceRoleService- Throws:
RedbackServiceException
-
moveTemplatedRole
public RoleInfo moveTemplatedRole(String templateId, String oldResource, String newResource) throws RedbackServiceException
Description copied from interface:RoleServiceMoves a templated role from one resource to another resource- Specified by:
moveTemplatedRolein interfaceRoleService- Parameters:
templateId- the template identifieroldResource- the resource of the current rolenewResource- the resource of the new role- Throws:
RedbackServiceException
-
checkTemplateRole
public javax.ws.rs.core.Response checkTemplateRole(String templateId, String resource) throws RedbackServiceException
- Specified by:
checkTemplateRolein interfaceRoleService- Throws:
RedbackServiceException
-
createTemplatedRole
public RoleInfo createTemplatedRole(String templateId, String resource) throws RedbackServiceException
- Specified by:
createTemplatedRolein interfaceRoleService- Throws:
RedbackServiceException
-
removeTemplatedRole
public javax.ws.rs.core.Response removeTemplatedRole(String templateId, String resource) throws RedbackServiceException
Description copied from interface:RoleServiceRemoves a role corresponding to the role Id that was manufactured with the given resource it also removes any user assignments for that role- Specified by:
removeTemplatedRolein interfaceRoleService- Throws:
RedbackServiceException
-
assignRole
public RoleInfo assignRole(String roleId, String userId) throws RedbackServiceException
Description copied from interface:RoleServiceAssigns the role indicated by the roleId to the given principal- Specified by:
assignRolein interfaceRoleService- Throws:
RedbackServiceException
-
assignTemplatedRole
public RoleInfo assignTemplatedRole(String templateId, String resource, String userId) throws RedbackServiceException
Description copied from interface:RoleServiceAssigns the templated role indicated by the templateId fails if the templated role has not been created- Specified by:
assignTemplatedRolein interfaceRoleService- Throws:
RedbackServiceException
-
deleteRoleAssignment
public RoleInfo deleteRoleAssignment(String roleId, String userId) throws RedbackServiceException
Description copied from interface:RoleServiceDeletes the assignment of a role to a user.- Specified by:
deleteRoleAssignmentin interfaceRoleService- Parameters:
roleId- the role iduserId- the user id- Throws:
RedbackServiceException
-
getRoleUsers
public org.apache.archiva.components.rest.model.PagedResult<UserInfo> getRoleUsers(String roleId, String recurse, String searchTerm, Integer offset, Integer limit, List<String> orderBy, String order) throws RedbackServiceException
Description copied from interface:RoleServiceThis returns the list of assigned users to a given role. The flag "recurse" is a query parameter. If the query parameter exists and is not set to 'false', or '0', it will recurse all parent roles and return a list of users assigned to the current role and the parent roles up to the root. If the query parameter does not exist or is set to 'false' or '0', it will return only the users assigned directly to the given role.- Specified by:
getRoleUsersin interfaceRoleService- Parameters:
roleId- the role identifier, for which the assigned users are returnedrecurse- if the parameter does not exist or is set to 'false' or '0', only directly assigned users are returned. If the parameter value is set to 'parentsOnly', the users assigned to all parent roles up to the root excluding the given role are returned. Otherwise all users assigned to the given role and all parent roles up to the root are returned.searchTerm- the substring query term to search for in the user ids and namesoffset- the offset index in the user list for paginglimit- the maximum number of users returnedorderBy- the order attributes for orderingorder- the order direction 'asc' (ascending), or 'desc' (descending)- Returns:
- the list of user objects
- Throws:
RedbackServiceException
-
getUnassignedUsers
public org.apache.archiva.components.rest.model.PagedResult<UserInfo> getUnassignedUsers(String roleId, String recurse, String searchTerm, Integer offset, Integer limit, List<String> orderBy, String order) throws RedbackServiceException
- Specified by:
getUnassignedUsersin interfaceRoleService- Throws:
RedbackServiceException
-
updateRole
public RoleInfo updateRole(String roleId, Role role) throws RedbackServiceException
Description copied from interface:RoleServiceUpdates a role. Attributes that are empty or null will be ignored.- Specified by:
updateRolein interfaceRoleService- Throws:
RedbackServiceException
-
getTemplates
public List<RoleTemplate> getTemplates() throws RedbackServiceException
- Specified by:
getTemplatesin interfaceRoleService- Throws:
RedbackServiceException
-
-