public final class RoleResourceHelper extends Object
Modifier and Type | Method and Description |
---|---|
static void |
assignOrRemoveRoleForEntity(Long topicId,
BlogRole role,
Long entityId)
Remove or assign role for entity
|
static void |
assignOrRemoveRoleForGroup(String groupAlias,
Long blogId,
BlogRole role)
Assign or remove role for a group
|
static void |
assignOrRemoveRoleForUser(String userAlias,
Long blogId,
BlogRole role)
Assign or remove role for a user
|
static void |
assignRoleResources(RoleResource[] roleResources,
Long topicId)
Assign role resources.
|
static BlogRole |
getBlogRole(ERole eRole)
Get topic role
|
static ERole |
getERole(BlogRole role)
Convert blog role to rest api resource role
|
public static void assignOrRemoveRoleForEntity(Long topicId, BlogRole role, Long entityId) throws NoBlogManagerLeftException, BlogNotFoundException, CommunoteEntityNotFoundException, AuthorizationException
topicId
- identifier of a blogrole
- role of the blogentityId
- identifier of an entity (user/group)NoBlogManagerLeftException
- no active user with managment rightsBlogNotFoundException
- blog not foundCommunoteEntityNotFoundException
- can not found entity (user/group)AuthorizationException
- in case the the current user tries to become manager of a topic but is not the
client managerpublic static void assignOrRemoveRoleForGroup(String groupAlias, Long blogId, BlogRole role) throws NoBlogManagerLeftException, BlogNotFoundException, CommunoteEntityNotFoundException, AuthorizationException
groupAlias
- alias of groupblogId
- identifier of the blogrole
- role of the blogNoBlogManagerLeftException
- no active user with managment rightsBlogNotFoundException
- blog not foundCommunoteEntityNotFoundException
- can not found entity (user/group)AuthorizationException
- should not occurpublic static void assignOrRemoveRoleForUser(String userAlias, Long blogId, BlogRole role) throws NoBlogManagerLeftException, BlogNotFoundException, CommunoteEntityNotFoundException, AuthorizationException
userAlias
- alias of userblogId
- identifier of the blogrole
- role of the blogNoBlogManagerLeftException
- no active user with managment rightsBlogNotFoundException
- blog not foundCommunoteEntityNotFoundException
- can not found entity (user/group)AuthorizationException
- in case the the current user tries to become manager of a topic but is not the
client managerpublic static void assignRoleResources(RoleResource[] roleResources, Long topicId) throws BlogNotFoundException, CommunoteEntityNotFoundException, NoBlogManagerLeftException, AuthorizationException
roleResources
- the external object resources.topicId
- the identifier of the topic.NoBlogManagerLeftException
- cannot add role because no topic manager exists after create of topicCommunoteEntityNotFoundException
- can not found entity (user or group)BlogNotFoundException
- can not found topicAuthorizationException
- in case the the current user tries to become manager of a topic but is not the
client managerpublic static BlogRole getBlogRole(ERole eRole)
eRole
- role of entityCopyright © 2019 Communote team. All rights reserved.