210 lines
17 KiB
Java
210 lines
17 KiB
Java
package com.inteligr8.alfresco.acs.api;
|
|
|
|
import com.inteligr8.alfresco.acs.model.Error;
|
|
import com.inteligr8.alfresco.acs.model.GroupBodyCreate;
|
|
import com.inteligr8.alfresco.acs.model.GroupBodyUpdate;
|
|
import com.inteligr8.alfresco.acs.model.GroupEntry;
|
|
import com.inteligr8.alfresco.acs.model.GroupMemberEntry;
|
|
import com.inteligr8.alfresco.acs.model.GroupMemberPaging;
|
|
import com.inteligr8.alfresco.acs.model.GroupMembershipBodyCreate;
|
|
import com.inteligr8.alfresco.acs.model.GroupPaging;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiResponse;
|
|
import io.swagger.annotations.ApiResponses;
|
|
import java.util.List;
|
|
import javax.ws.rs.*;
|
|
|
|
/**
|
|
* Alfresco Content Services REST API
|
|
*
|
|
* <p>**Core API** Provides access to the core features of Alfresco Content Services.
|
|
*
|
|
*/
|
|
@Path("/api/-default-/public/alfresco/versions/1")
|
|
@Api(value = "/api/-default-/public/alfresco/versions/1", description = "")
|
|
public interface GroupsApi {
|
|
|
|
/**
|
|
* Create a group
|
|
*
|
|
* **Note:** this endpoint is available in Alfresco 5.2.1 and newer versions. Create a group. The group id must start with \"GROUP\\_\". If this is omitted it will be added automatically. This format is also returned when listing groups or group memberships. It should be noted that the other group-related operations also expect the id to start with \"GROUP\\_\". If one or more parentIds are specified then the group will be created and become a member of each of the specified parent groups. If no parentIds are specified then the group will be created as a root group. The group will be created in the **APP.DEFAULT** and **AUTH.ALF** zones. You must have admin rights to create a group.
|
|
*
|
|
*/
|
|
@POST
|
|
@Path("/groups")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "Create a group", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 201, message = "Successful response", response = GroupEntry.class),
|
|
@ApiResponse(code = 400, message = "Invalid parameter: invalid **groupBodyCreate** "),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 403, message = "User does not have permission to create a group"),
|
|
@ApiResponse(code = 404, message = "**parentIds** does not exist "),
|
|
@ApiResponse(code = 409, message = "**id** clashes with an existing group "),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public GroupEntry createGroup(GroupBodyCreate groupBodyCreate, @QueryParam("include")List<String> include, @QueryParam("fields")List<String> fields);
|
|
|
|
/**
|
|
* Create a group membership
|
|
*
|
|
* **Note:** this endpoint is available in Alfresco 5.2.1 and newer versions. Create a group membership (for an existing person or group) within a group **groupId**. If the added group was previously a root group then it becomes a non-root group since it now has a parent. It is an error to specify an **id** that does not exist. You must have admin rights to create a group membership.
|
|
*
|
|
*/
|
|
@POST
|
|
@Path("/groups/{groupId}/members")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "Create a group membership", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 201, message = "Successful response", response = GroupMemberEntry.class),
|
|
@ApiResponse(code = 400, message = "Invalid parameter: **groupId** or **groupMembershipBodyCreate** is invalid "),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 403, message = "User does not have permission to create a group membership"),
|
|
@ApiResponse(code = 404, message = "**groupId** or *id* (of group or person) does not exist "),
|
|
@ApiResponse(code = 409, message = "Trying to modify a pre-defined system group, such as GROUP_EVERYONE. "),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public GroupMemberEntry createGroupMembership(@PathParam("groupId") String groupId, GroupMembershipBodyCreate groupMembershipBodyCreate, @QueryParam("fields")List<String> fields);
|
|
|
|
/**
|
|
* Delete a group
|
|
*
|
|
* **Note:** this endpoint is available in Alfresco 5.2.1 and newer versions. Delete group **groupId**. The option to cascade delete applies this recursively to any hierarchy of group members. In this case, removing a group member does not delete the person or sub-group itself. If a removed sub-group no longer has any parent groups then it becomes a root group. You must have admin rights to delete a group.
|
|
*
|
|
*/
|
|
@DELETE
|
|
@Path("/groups/{groupId}")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "Delete a group", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 204, message = "Successful response"),
|
|
@ApiResponse(code = 400, message = "Invalid parameter: **groupId** is invalid "),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 403, message = "User does not have permission to delete a group member"),
|
|
@ApiResponse(code = 404, message = "**groupId** does not exist "),
|
|
@ApiResponse(code = 409, message = "Trying to delete a pre-defined system group, such as GROUP_EVERYONE. "),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public void deleteGroup(@PathParam("groupId") String groupId, @QueryParam("cascade")@DefaultValue("false") Boolean cascade);
|
|
|
|
/**
|
|
* Delete a group membership
|
|
*
|
|
* **Note:** this endpoint is available in Alfresco 5.2.1 and newer versions. Delete group member **groupMemberId** (person or sub-group) from group **groupId**. Removing a group member does not delete the person or sub-group itself. If a removed sub-group no longer has any parent groups then it becomes a root group. You must have admin rights to delete a group membership.
|
|
*
|
|
*/
|
|
@DELETE
|
|
@Path("/groups/{groupId}/members/{groupMemberId}")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "Delete a group membership", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 204, message = "Successful response"),
|
|
@ApiResponse(code = 400, message = "Invalid parameter: value of **groupId**, or **groupMemberId** is invalid "),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 403, message = "User does not have permission to delete a group membership"),
|
|
@ApiResponse(code = 404, message = "**groupId** or **groupMemberId** does not exist "),
|
|
@ApiResponse(code = 409, message = "Trying to delete a member of a pre-defined system group, such as GROUP_EVERYONE "),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public void deleteGroupMembership(@PathParam("groupId") String groupId, @PathParam("groupMemberId") String groupMemberId);
|
|
|
|
/**
|
|
* Get group details
|
|
*
|
|
* **Note:** this endpoint is available in Alfresco 5.2.1 and newer versions. Get details for group **groupId**. You can use the **include** parameter to return additional information.
|
|
*
|
|
*/
|
|
@GET
|
|
@Path("/groups/{groupId}")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "Get group details", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 200, message = "Successful response", response = GroupEntry.class),
|
|
@ApiResponse(code = 400, message = "Invalid parameter: invalid **groupId** "),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 404, message = "**groupId** does not exist "),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public GroupEntry getGroup(@PathParam("groupId") String groupId, @QueryParam("include")List<String> include, @QueryParam("fields")List<String> fields);
|
|
|
|
/**
|
|
* List memberships of a group
|
|
*
|
|
* **Note:** this endpoint is available in Alfresco 5.2.1 and newer versions. Gets a list of the group memberships for the group **groupId**. You can use the **where** parameter to filter the returned groups by **memberType**. Example to filter by **memberType**, use any one of: ``` (memberType='GROUP') (memberType='PERSON') ``` The default sort order for the returned list is for group members to be sorted by ascending displayName. You can override the default by using the **orderBy** parameter. You can specify one of the following fields in the **orderBy** parameter: * id * displayName
|
|
*
|
|
*/
|
|
@GET
|
|
@Path("/groups/{groupId}/members")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "List memberships of a group", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 200, message = "Successful response", response = GroupMemberPaging.class),
|
|
@ApiResponse(code = 400, message = "Invalid parameter: value of **maxItems**, **skipCount**, **orderBy**, or **where** is invalid "),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 404, message = "**groupId** does not exist "),
|
|
@ApiResponse(code = 405, message = "Trying to list all members of a pre-defined system group, such as GROUP_EVERYONE "),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public GroupMemberPaging listGroupMemberships(@PathParam("groupId") String groupId, @QueryParam("skipCount")@DefaultValue("0") Integer skipCount, @QueryParam("maxItems")@DefaultValue("100") Integer maxItems, @QueryParam("orderBy")List<String> orderBy, @QueryParam("where")String where, @QueryParam("fields")List<String> fields);
|
|
|
|
/**
|
|
* List group memberships
|
|
*
|
|
* **Note:** this endpoint is available in Alfresco 5.2.1 and newer versions. Gets a list of group membership information for person **personId**. You can use the `-me-` string in place of `<personId>` to specify the currently authenticated user. You can use the **include** parameter to return additional information. You can use the **where** parameter to filter the returned groups by **isRoot**. For example, the following **where** clause will return just the root groups: ``` (isRoot=true) ``` The **where** parameter can also be used to filter by ***zone***. This may be combined with isRoot to narrow a result set even further. For example, the following where clause will only return groups belonging to the `MY.ZONE` zone. ``` where=(zones in ('MY.ZONE')) ``` This may be combined with the isRoot filter, as shown below: ``` where=(isRoot=false AND zones in ('MY.ZONE')) ``` ***Note:*** restrictions include * `AND` is the only supported operator when combining `isRoot` and `zones` filters * Only one zone is supported by the filter * The quoted zone name must be placed in parenthesis — a 400 error will result if these are omitted. The default sort order for the returned list is for groups to be sorted by ascending displayName. You can override the default by using the **orderBy** parameter. You can specify one or more of the following fields in the **orderBy** parameter: * id * displayName
|
|
*
|
|
*/
|
|
@GET
|
|
@Path("/people/{personId}/groups")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "List group memberships", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 200, message = "Successful response", response = GroupPaging.class),
|
|
@ApiResponse(code = 400, message = "Invalid parameter: value of **maxItems**, **skipCount**, **orderBy** or **personId** is invalid "),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 404, message = "**personId** does not exist "),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public GroupPaging listGroupMembershipsForPerson(@PathParam("personId") String personId, @QueryParam("skipCount")@DefaultValue("0") Integer skipCount, @QueryParam("maxItems")@DefaultValue("100") Integer maxItems, @QueryParam("orderBy")List<String> orderBy, @QueryParam("include")List<String> include, @QueryParam("where")String where, @QueryParam("fields")List<String> fields);
|
|
|
|
/**
|
|
* List groups
|
|
*
|
|
* **Note:** this endpoint is available in Alfresco 5.2.1 and newer versions. Gets a list of groups. You can use the **include** parameter to return additional information. You can use the **where** parameter to filter the returned groups by **isRoot**. For example, the following **where** clause will return just the root groups: ``` (isRoot=true) ``` The **where** parameter can also be used to filter by ***zone*** and ***displayName***. They may be combined with isRoot to narrow a result set even further. For example, the following where clause will only return groups belonging to the `MY.ZONE` zone. ``` where=(zones in ('MY.ZONE')) ``` This may be combined with the isRoot filter, as shown below: ``` where=(isRoot=false AND zones in ('MY.ZONE')) ``` The following where clause will only return groups with displayName `MY.GROUP.NAME`. ``` where=(displayName in ('MY.GROUP.NAME')) ``` This may be combined with the isRoot and zones filter, as shown below: ``` where=(isRoot=false AND displayName in ('MY.GROUP.NAME')) ``` ``` where=(zones in ('MY.ZONE') AND displayName in ('MY.GROUP.NAME')) ``` ``` where=(isRoot=false AND zones in ('MY.ZONE') AND displayName in ('MY.GROUP.NAME')) ``` ***Note:*** restrictions include * `AND` is the only supported operator when combining `isRoot`, `zones` and `displayName` filters * Only one zone is supported by the filter * Only one displayName is supported by the filter * The quoted zone name and displayName must be placed in parenthesis — a 400 error will result if these are omitted. The default sort order for the returned list is for groups to be sorted by ascending displayName. You can override the default by using the **orderBy** parameter. You can specify one of the following fields in the **orderBy** parameter: * id * displayName
|
|
*
|
|
*/
|
|
@GET
|
|
@Path("/groups")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "List groups", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 200, message = "Successful response", response = GroupPaging.class),
|
|
@ApiResponse(code = 400, message = "Invalid parameter: value of **maxItems** or **skipCount**, or **orderBy**, or **where** is invalid "),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public GroupPaging listGroups(@QueryParam("skipCount")@DefaultValue("0") Integer skipCount, @QueryParam("maxItems")@DefaultValue("100") Integer maxItems, @QueryParam("orderBy")List<String> orderBy, @QueryParam("include")List<String> include, @QueryParam("where")String where, @QueryParam("fields")List<String> fields);
|
|
|
|
/**
|
|
* Update group details
|
|
*
|
|
* **Note:** this endpoint is available in Alfresco 5.2.1 and newer versions. Update details (displayName) for group **groupId**. You must have admin rights to update a group.
|
|
*
|
|
*/
|
|
@PUT
|
|
@Path("/groups/{groupId}")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "Update group details", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 200, message = "Successful response", response = GroupEntry.class),
|
|
@ApiResponse(code = 400, message = "Invalid parameter: **groupId** or **groupBodyCreate** is invalid "),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 403, message = "User does not have permission to update a group"),
|
|
@ApiResponse(code = 404, message = "**groupId** does not exist "),
|
|
@ApiResponse(code = 409, message = "Trying to modify a pre-defined system group, such as GROUP_EVERYONE "),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public GroupEntry updateGroup(@PathParam("groupId") String groupId, GroupBodyUpdate groupBodyUpdate, @QueryParam("include")List<String> include, @QueryParam("fields")List<String> fields);
|
|
}
|
|
|