Class UserGroupProfileResource
- java.lang.Object
-
- org.silverpeas.core.web.rs.RESTWebService
-
- org.silverpeas.core.webapi.profile.UserGroupProfileResource
-
- All Implemented Interfaces:
ProtectedWebResource
,WebAuthenticationValidation
,WebAuthorizationValidation
,SilverpeasWebResource
@WebService @Path("profile/groups") @Authenticated public class UserGroupProfileResource extends RESTWebService
A REST-based Web service that acts on the user groups in Silverpeas. Each provided method is a way to access a representation of one or several user groups. This representation is vehiculed as a Web entity in the HTTP requests and responses. The user groups that are published depend on some parameters whose the domain isolation and the profile of the user behind the requesting. The domain isolation defines the visibility of a user or a group of groups in a given domain to the others domains in Silverpeas.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.silverpeas.core.web.rs.RESTWebService
RESTWebService.WebProcess<R>, RESTWebService.WebTreatment<R>
-
-
Field Summary
Fields Modifier and Type Field Description static String
RESPONSE_HEADER_GROUPSIZE
The HTTP header parameter that provides the real size of the group profiles that match a query.-
Fields inherited from class org.silverpeas.core.web.rs.RESTWebService
RESPONSE_HEADER_ARRAYSIZE
-
Fields inherited from interface org.silverpeas.core.web.SilverpeasWebResource
BASE_PATH
-
-
Constructor Summary
Constructors Constructor Description UserGroupProfileResource()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.ws.rs.core.Response
getAllRootGroups(Set<String> groupIds, boolean withChildren, String name, String page, String domain, Set<UserState> userStatesToExclude)
Gets all the root user groups in Silverpeas.String
getComponentId()
Gets the identifier of the component instance to which the requested resource belongs to.UserGroupProfileEntity
getGroup(String groupPath)
Gets the group of users identified by the specified path.javax.ws.rs.core.Response
getGroupsInApplication(String instanceId, boolean withChildren, String roles, boolean matchingAllRoles, String resource, String name, String page, String domain, Set<UserState> userStatesToExclude)
Gets the groups of users having the priviledges to access the specified Silverpeas application instance.protected String
getResourceBasePath()
Gets the base path of the web resource relative to the root path of all the web resources in Silverpeas as given bySilverpeasWebResource.getBasePath()
.javax.ws.rs.core.Response
getSubGroups(String groups, String name, String page, boolean withChildren, Set<UserState> userStatesToExclude)
Gets the direct subgroups of the group of groups identified by the specified path.protected static URI
identifiedBy(URI uri)
protected static URI
locatedAt(URI uri)
-
Methods inherited from class org.silverpeas.core.web.rs.RESTWebService
createWebResourceUri, fromPage, getBundle, getBundleLocation, getHighestUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getSilverpeasContext, getUri, getUser, getUserPreferences, getUserRoles, identifiedBy, identifiedBy, initContext, initWebResourceUri, isUserDefined, process
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.web.rs.ProtectedWebResource
validateUserAuthorization
-
Methods inherited from interface org.silverpeas.core.web.rs.WebAuthenticationValidation
validateUserAuthentication
-
-
-
-
Field Detail
-
RESPONSE_HEADER_GROUPSIZE
public static final String RESPONSE_HEADER_GROUPSIZE
The HTTP header parameter that provides the real size of the group profiles that match a query. This parameter is useful for clients that use the pagination to filter the count of group profiles to sent back.- See Also:
- Constant Field Values
-
-
Method Detail
-
getAllRootGroups
@GET @Produces("application/json") public javax.ws.rs.core.Response getAllRootGroups(@QueryParam("ids") Set<String> groupIds, @QueryParam("withChildren") boolean withChildren, @QueryParam("name") String name, @QueryParam("page") String page, @QueryParam("domain") String domain, @QueryParam("userStatesToExclude") Set<UserState> userStatesToExclude)
Gets all the root user groups in Silverpeas.- Parameters:
groupIds
- requested group identifiers. If this parameter is filled, sub groups are also returned.withChildren
- if true the sub groups are also returned.name
- a pattern on the name of the root groups to retrieve. If null, all the root groups are fetched.domain
- the unique identifier of the domain the groups has to be related.page
- the pagination parameters formatted as "page number;item count in the page". From this parameter is computed the part of groups to sent back: those between ((page number - 1) item count in the page) and ((page number - 1) item count in the page + item count in the page).userStatesToExclude
- the user states that users taken into account must not be in.- Returns:
- the JSON representation of the array of the groups matching the pattern.
-
getGroupsInApplication
@GET @Path("application/{instanceId}") @Produces("application/json") public javax.ws.rs.core.Response getGroupsInApplication(@PathParam("instanceId") String instanceId, @QueryParam("withChildren") boolean withChildren, @QueryParam("roles") String roles, @QueryParam("matchingAllRoles") boolean matchingAllRoles, @QueryParam("resource") String resource, @QueryParam("name") String name, @QueryParam("page") String page, @QueryParam("domain") String domain, @QueryParam("userStatesToExclude") Set<UserState> userStatesToExclude)
Gets the groups of users having the priviledges to access the specified Silverpeas application instance. In the context some groups are parents of others groups, only the parent groups are fetched, no their subgroups.- Parameters:
instanceId
- the unique identifier of the Silverpeas application instance.withChildren
- if true the sub groups are also returned.roles
- the roles the groups must play. Null if no specific roles have to be played by the groups.matchingAllRoles
- boolean at true if the groups must play all the roles, false otherwise.resource
- the unique identifier of the resource in the component instance the groups to get must have enough rights to access. This query filter is coupled with theroles
one. If it is not set, by default the resource refered is the whole component instance. As for component instance identifier, a resource one is defined by its type followed by its identifier.name
- the pattern on the name the groups name must match. Null if all groups for the specified application have to be fetched.page
- the pagination parameters formatted as "page number;item count in the page". From this parameter is computed the part of groups to sent back: those between ((page number - 1) item count in the page) and ((page number - 1) item count in the page + item count in the page).domain
- the unique identifier of the domain the groups has to be related.userStatesToExclude
- the user states that users taken into account must not be in.- Returns:
- the JSON representation of the array with the parent groups having access the application instance.
-
getGroup
@GET @Path("{path: [0-9]+(/groups/[0-9]+)*}") @Produces("application/json") public UserGroupProfileEntity getGroup(@PathParam("path") String groupPath)
Gets the group of users identified by the specified path.- Parameters:
groupPath
- the path of group identifiers, from the root group downto the seeked one.- Returns:
- the JSON representation of the user group.
-
getSubGroups
@GET @Path("{path:[0-9]+/groups(/[0-9]+/groups)*}") @Produces("application/json") public javax.ws.rs.core.Response getSubGroups(@PathParam("path") String groups, @QueryParam("name") String name, @QueryParam("page") String page, @QueryParam("withChildren") boolean withChildren, @QueryParam("userStatesToExclude") Set<UserState> userStatesToExclude)
Gets the direct subgroups of the group of groups identified by the specified path.- Parameters:
groups
- the path of group identifiers, from the root group downto the group for which the direct subgroups are seeked.name
- a pattern the subgroup names must match. If null, all the direct subgroups are fetched.page
- the pagination parameters formatted as "page number;item count in the page". From this parameter is computed the part of groups to sent back: those between ((page number - 1) item count in the page) and ((page number - 1) item count in the page + item count in the page).withChildren
- if true the sub groups are also returned.userStatesToExclude
- the user states that users taken into account must not be in.- Returns:
- a JSON representation of the array of the direct subgroups.
-
getResourceBasePath
protected String getResourceBasePath()
Description copied from class:RESTWebService
Gets the base path of the web resource relative to the root path of all the web resources in Silverpeas as given bySilverpeasWebResource.getBasePath()
.- Specified by:
getResourceBasePath
in classRESTWebService
- Returns:
- the relative path that identifies this REST web service among all other REST web services.
-
getComponentId
public String getComponentId()
Description copied from interface:SilverpeasWebResource
Gets the identifier of the component instance to which the requested resource belongs to.- Returns:
- the identifier of the Silverpeas component instance.
-
-