Class GroupServiceImpl
java.lang.Object
org.craftercms.studio.impl.v2.service.security.GroupServiceImpl
- All Implemented Interfaces:
GroupService
-
Constructor Summary
ConstructorsConstructorDescriptionGroupServiceImpl
(GroupServiceInternal groupServiceInternal, OrganizationServiceInternal organizationServiceInternal, UserServiceInternal userServiceInternal, GeneralLockService generalLockService, StudioConfiguration studioConfiguration, AuditServiceInternal auditServiceInternal, SiteService siteService) -
Method Summary
Modifier and TypeMethodDescriptionaddGroupMembers
(long groupId, List<Long> userIds, List<String> usernames) Add users to the groupcreateGroup
(long orgId, String groupName, String groupDescription, boolean externallyManaged) Create groupvoid
deleteGroup
(List<Long> groupIds) Delete group(s)getAllGroups
(long orgId, String keyword, int offset, int limit, String sort) Get all groupsint
getAllGroupsTotal
(long orgId, String keyword) Get total number of all groupsgetGroup
(long groupId) Get groupgetGroupMembers
(long groupId, int offset, int limit, String sort) Get group membersint
getGroupMembersTotal
(long groupId) Get total number of group membersvoid
removeGroupMembers
(long groupId, List<Long> userIds, List<String> usernames) Remove users from the groupupdateGroup
(long orgId, Group group) Update group
-
Constructor Details
-
GroupServiceImpl
@ConstructorProperties({"groupServiceInternal","organizationServiceInternal","userServiceInternal","generalLockService","studioConfiguration","auditServiceInternal","siteService"}) public GroupServiceImpl(GroupServiceInternal groupServiceInternal, OrganizationServiceInternal organizationServiceInternal, UserServiceInternal userServiceInternal, GeneralLockService generalLockService, StudioConfiguration studioConfiguration, AuditServiceInternal auditServiceInternal, SiteService siteService)
-
-
Method Details
-
getAllGroups
public List<Group> getAllGroups(long orgId, String keyword, int offset, int limit, String sort) throws ServiceLayerException, OrganizationNotFoundException Description copied from interface:GroupService
Get all groups- Specified by:
getAllGroups
in interfaceGroupService
- Parameters:
orgId
- Organization identifierkeyword
- keyword to filter groupsoffset
- Result set offsetlimit
- Result set limitsort
- Sort order- Returns:
- List of groups
- Throws:
ServiceLayerException
- general service errorOrganizationNotFoundException
- organization not found
-
getAllGroupsTotal
public int getAllGroupsTotal(long orgId, String keyword) throws ServiceLayerException, OrganizationNotFoundException Description copied from interface:GroupService
Get total number of all groups- Specified by:
getAllGroupsTotal
in interfaceGroupService
- Parameters:
orgId
- Organization identifierkeyword
- keyword to filter groups- Returns:
- Number of groups
- Throws:
ServiceLayerException
- general service errorOrganizationNotFoundException
- organization not found
-
createGroup
public Group createGroup(long orgId, String groupName, String groupDescription, boolean externallyManaged) throws GroupAlreadyExistsException, ServiceLayerException, AuthenticationException Description copied from interface:GroupService
Create group- Specified by:
createGroup
in interfaceGroupService
- Parameters:
orgId
- Organization identifiergroupName
- Group namegroupDescription
- Group descriptionexternallyManaged
- true if group is externally managed, false otherwise- Returns:
- the created group
- Throws:
GroupAlreadyExistsException
- group already exist errorServiceLayerException
- general service errorAuthenticationException
- authentication error
-
updateGroup
public Group updateGroup(long orgId, Group group) throws ServiceLayerException, GroupNotFoundException, AuthenticationException, GroupExternallyManagedException Description copied from interface:GroupService
Update group- Specified by:
updateGroup
in interfaceGroupService
- Parameters:
orgId
- Organization identifiergroup
- Group to update- Returns:
- the updated group
- Throws:
ServiceLayerException
- general service errorGroupNotFoundException
- group not found errorAuthenticationException
- authentication errorGroupExternallyManagedException
- if group is externally managed
-
deleteGroup
public void deleteGroup(List<Long> groupIds) throws ServiceLayerException, GroupNotFoundException, AuthenticationException, GroupExternallyManagedException Description copied from interface:GroupService
Delete group(s)- Specified by:
deleteGroup
in interfaceGroupService
- Parameters:
groupIds
- Group identifiers- Throws:
ServiceLayerException
- general service errorGroupNotFoundException
- group not foundAuthenticationException
- authentication errorGroupExternallyManagedException
- if group is externally managed
-
getGroup
Description copied from interface:GroupService
Get group- Specified by:
getGroup
in interfaceGroupService
- Parameters:
groupId
- Group identifier- Returns:
- Group
- Throws:
ServiceLayerException
- general service errorGroupNotFoundException
- group not found
-
getGroupMembers
public List<UserResponse> getGroupMembers(long groupId, int offset, int limit, String sort) throws ServiceLayerException, GroupNotFoundException Description copied from interface:GroupService
Get group members- Specified by:
getGroupMembers
in interfaceGroupService
- Parameters:
groupId
- Group identifieroffset
- Result set offsetlimit
- Result set limitsort
- Sort order- Returns:
- List of users
- Throws:
ServiceLayerException
- general service errorGroupNotFoundException
- group not found
-
getGroupMembersTotal
Description copied from interface:GroupService
Get total number of group members- Specified by:
getGroupMembersTotal
in interfaceGroupService
- Parameters:
groupId
- Group identifier- Returns:
- Number of members
- Throws:
ServiceLayerException
- general service errorGroupNotFoundException
- group not found
-
addGroupMembers
public List<UserResponse> addGroupMembers(long groupId, List<Long> userIds, List<String> usernames) throws ServiceLayerException, UserNotFoundException, GroupNotFoundException, AuthenticationException Description copied from interface:GroupService
Add users to the group- Specified by:
addGroupMembers
in interfaceGroupService
- Parameters:
groupId
- Group identifieruserIds
- List of user identifiersusernames
- List of usernames- Returns:
- users added to the group
- Throws:
ServiceLayerException
- general service errorUserNotFoundException
- user not foundGroupNotFoundException
- group not foundAuthenticationException
- authentication error
-
removeGroupMembers
public void removeGroupMembers(long groupId, List<Long> userIds, List<String> usernames) throws ServiceLayerException, UserNotFoundException, GroupNotFoundException, AuthenticationException Description copied from interface:GroupService
Remove users from the group- Specified by:
removeGroupMembers
in interfaceGroupService
- Parameters:
groupId
- Group identifieruserIds
- List of user identifiersusernames
- List of usernames- Throws:
ServiceLayerException
- general service errorUserNotFoundException
- user not foundGroupNotFoundException
- group not foundAuthenticationException
- authentication error
-