Interface RoleService
-
- All Known Implementing Classes:
DefaultRoleService
@Path("/roles") public interface RoleService
Service interface for role management.- Since:
- 3.0
- Author:
- Olivier Lamy, Martin Stockhammer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RoleInfo
assignRole(String roleId, String userId)
Assigns the role indicated by the roleId to the given principalRoleInfo
assignTemplatedRole(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.Response
checkRole(String roleId)
javax.ws.rs.core.Response
checkTemplateRole(String templateId, String resource)
RoleInfo
createTemplatedRole(String templateId, String resource)
RoleInfo
deleteRoleAssignment(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)
RoleInfo
getRole(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)
RoleInfo
moveTemplatedRole(String templateId, String oldResource, String newResource)
Moves a templated role from one resource to another resourcejavax.ws.rs.core.Response
removeTemplatedRole(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 roleRoleInfo
updateRole(String roleId, Role role)
Updates a role.
-
-
-
Method Detail
-
getAllRoles
@Path("") @GET @Produces("application/json") org.apache.archiva.components.rest.model.PagedResult<RoleInfo> getAllRoles(@QueryParam("q") @DefaultValue("") String searchTerm, @QueryParam("offset") @DefaultValue("0") Integer offset, @QueryParam("limit") @DefaultValue("100") Integer limit, @QueryParam("orderBy") @DefaultValue("id") List<String> orderBy, @QueryParam("order") @DefaultValue("asc") String order) throws RedbackServiceException
- Throws:
RedbackServiceException
-
getRole
@Path("{roleId}") @GET @Produces("application/json") RoleInfo getRole(@PathParam("roleId") String roleId) throws RedbackServiceException
- Throws:
RedbackServiceException
-
checkRole
@Path("{roleId}") @HEAD @Produces("application/json") javax.ws.rs.core.Response checkRole(@PathParam("roleId") String roleId) throws RedbackServiceException
- Throws:
RedbackServiceException
-
moveTemplatedRole
@Path("templates/{templateId}/{oldResource}/moveto/{newResource}") @POST @Produces("application/json") RoleInfo moveTemplatedRole(@PathParam("templateId") String templateId, @PathParam("oldResource") String oldResource, @PathParam("newResource") String newResource) throws RedbackServiceException
Moves a templated role from one resource to another resource- Parameters:
templateId
- the template identifieroldResource
- the resource of the current rolenewResource
- the resource of the new role- Throws:
RedbackServiceException
-
checkTemplateRole
@Path("templates/{templateId}/{resource}") @HEAD @Produces("application/json") javax.ws.rs.core.Response checkTemplateRole(@PathParam("templateId") String templateId, @PathParam("resource") String resource) throws RedbackServiceException
- Throws:
RedbackServiceException
-
createTemplatedRole
@Path("templates/{templateId}/{resource}") @PUT @Produces("application/json") RoleInfo createTemplatedRole(@PathParam("templateId") String templateId, @PathParam("resource") String resource) throws RedbackServiceException
- Throws:
RedbackServiceException
-
removeTemplatedRole
@Path("templates/{templateId}/{resource}") @DELETE @Produces("application/json") javax.ws.rs.core.Response removeTemplatedRole(@PathParam("templateId") String templateId, @PathParam("resource") String resource) throws RedbackServiceException
Removes a role corresponding to the role Id that was manufactured with the given resource it also removes any user assignments for that role- Parameters:
templateId
-resource
-- Throws:
RedbackServiceException
-
assignTemplatedRole
@Path("templates/{templateId}/{resource}/user/{userId}") @PUT @Produces("application/json") RoleInfo assignTemplatedRole(@PathParam("templateId") String templateId, @PathParam("resource") String resource, @PathParam("userId") String userId) throws RedbackServiceException
Assigns the templated role indicated by the templateId fails if the templated role has not been created- Parameters:
templateId
-resource
-userId
-- Throws:
RedbackServiceException
-
assignRole
@Path("{roleId}/user/{userId}") @PUT @Produces("application/json") RoleInfo assignRole(@PathParam("roleId") String roleId, @PathParam("userId") String userId) throws RedbackServiceException
Assigns the role indicated by the roleId to the given principal- Parameters:
roleId
-userId
-- Throws:
RedbackServiceException
-
deleteRoleAssignment
@Path("{roleId}/user/{userId}") @DELETE @Produces("application/json") RoleInfo deleteRoleAssignment(@PathParam("roleId") String roleId, @PathParam("userId") String userId) throws RedbackServiceException
Deletes the assignment of a role to a user.- Parameters:
roleId
- the role iduserId
- the user id- Throws:
RedbackServiceException
-
getRoleUsers
@Path("{roleId}/user") @GET @Produces("application/json") org.apache.archiva.components.rest.model.PagedResult<UserInfo> getRoleUsers(@PathParam("roleId") String roleId, @QueryParam("recurse") String recurse, @QueryParam("q") @DefaultValue("") String searchTerm, @QueryParam("offset") @DefaultValue("0") Integer offset, @QueryParam("limit") @DefaultValue("100") Integer limit, @QueryParam("orderBy") @DefaultValue("id") List<String> orderBy, @QueryParam("order") @DefaultValue("asc") String order) throws RedbackServiceException
This 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.- 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
@Path("{roleId}/unassigned") @GET @Produces("application/json") org.apache.archiva.components.rest.model.PagedResult<UserInfo> getUnassignedUsers(@PathParam("roleId") String roleId, @QueryParam("recurse") String recurse, @QueryParam("q") @DefaultValue("") String searchTerm, @QueryParam("offset") @DefaultValue("0") Integer offset, @QueryParam("limit") @DefaultValue("100") Integer limit, @QueryParam("orderBy") @DefaultValue("id") List<String> orderBy, @QueryParam("order") @DefaultValue("asc") String order) throws RedbackServiceException
- Throws:
RedbackServiceException
-
updateRole
@Path("{roleId}") @PATCH @Produces("application/json") RoleInfo updateRole(@PathParam("roleId") String roleId, Role role) throws RedbackServiceException
Updates a role. Attributes that are empty or null will be ignored.- Throws:
RedbackServiceException
- Since:
- 3.0
-
getTemplates
@Path("templates") @GET @Produces("application/json") List<RoleTemplate> getTemplates() throws RedbackServiceException
- Throws:
RedbackServiceException
-
-