public interface BlogRightsManagement
Modifier and Type | Method and Description |
---|---|
void |
addEntity(Long topicId,
Long entityId,
BlogRole role)
Adds member with the given role to the blog.
|
void |
addEntityForExternal(Long topicId,
Long entityId,
BlogRole role,
String externalSystemId,
String externalObjectId)
Add a member with the given role to the blog on the behalf of an external system.
|
void |
addEntityForExternalTrusted(Long topicId,
Long entityId,
BlogRole role,
String externalSystemId)
Add a member with the given role to the blog on the behalf of an external system.
|
void |
assignEntity(Long topicId,
Long entityId,
BlogRole role)
Add a member with the given role to the blog.
|
void |
assignEntity(Long blogId,
Long entityId,
BlogRole role,
boolean createNote)
Adds member with the given role to the blog.
|
void |
assignEntityForExternal(Long topicId,
Long entityId,
BlogRole role,
String externalSystemId,
String externalObjectId)
Add or update a member with the given role on the behalf of an external system.
|
void |
assignEntityForExternalTrusted(Long topicId,
Long entityId,
BlogRole role,
String externalSystemId)
Add or update a member with the given role on the behalf of an external system.
|
void |
assignManagementAccessToCurrentUser(Long topicId)
Assigns the management role to the current user.
|
void |
changePublicAccess(Long topicId,
boolean allowPublicAccess)
Change the public access to a blog.
|
void |
changeRoleOfMemberByEntityId(Long topicId,
Long entityId,
BlogRole role)
Changes the role of a blog member.
|
void |
changeRoleOfMemberByEntityIdForExternal(Long topicId,
Long entityId,
BlogRole role,
String externalSystemId)
Change the role of a blog member that was added on the behalf of an external system.
|
boolean |
currentUserHasManagementAccess(Long topicId)
Tests whether the current user is manager of a blog.
|
boolean |
currentUserHasReadAccess(Long topicId,
boolean ignoreAllCanFlags)
Tests whether the current user has read access to a blog.
|
boolean |
currentUserHasWriteAccess(Long topicId,
boolean ignoreAllCanFlags)
Tests whether the current user has write access to a blog.
|
Blog |
getAndCheckBlogAccess(Long topicId,
BlogRole blogRole)
Check if a topic exists and the current user has access to that topic.
|
<T> Collection<T> |
getMappedUsers(Long topicId,
CollectionConverter<UserToBlogRoleMapping,T> converter,
BlogRole... roles)
Method to get all users for a given topic with the specified roles.
|
BlogRole |
getRoleOfCurrentUser(Long topicId,
boolean ignoreAllCanFlags)
Returns the blog role of the current user.
|
BlogRole |
getRoleOfEntity(Long topicId,
Long entityId,
boolean ignoreAllCanFlags)
Returns the blog role of an entity or null if the entity does not have access to the blog.
|
BlogRole |
getRoleOfUser(Long topicId,
Long userId,
boolean ignoreAllCanFlags)
Returns the blog role of a user.
|
boolean |
hasAnotherManager(Long topicId,
Long userId)
Returns true if the blog has another active user as member with management access right.
|
boolean |
hasAnotherReader(Long topicId,
Long userId)
Returns true if the blog has another reader than the user passed in.
|
boolean |
isEntityDirectMember(Long topicId,
Long entityId)
Returns true if the entity was added to the blog.
|
void |
removeMemberByEntityId(Long topicId,
Long entityId) |
void |
removeMemberByEntityIdForExternal(Long topicId,
Long entityId,
String externalSystemId) |
void |
removeUserFromAllBlogs(Long userId,
Collection<Long> blogsToNotCheckForLastManager)
Removes all the direct blog memberships of a user.
|
Blog |
setAllCanReadAllCanWrite(Long topicId,
boolean allCanRead,
boolean allCanWrite)
Update the blog all you can read /write only
|
boolean |
userHasManagementAccess(Long topicId,
Long userId)
Test whether a user is manager of a blog.
|
boolean |
userHasReadAccess(Long topicId,
Long userId,
boolean ignoreAllCanFlags)
Test whether a user has read access to a blog.
|
boolean |
userHasWriteAccess(Long topicId,
Long userId,
boolean ignoreAllCanFlags)
Tests whether a user has write access to a blog.
|
void addEntity(Long topicId, Long entityId, BlogRole role) throws CommunoteEntityNotFoundException, BlogNotFoundException, BlogAccessException
Adds member with the given role to the blog. If the entity already is a member of the blog, nothing will happen.
topicId
- ID of the blogentityId
- ID of a user or a grouprole
- the role describing the access right the entity should getCommunoteEntityNotFoundException
- in case the user or group does not existBlogNotFoundException
- in case the blog does not existBlogAccessException
- in case the current user is not allowed to add an entity to the blog. This
exception won't be thrown during blog creation.void addEntityForExternal(Long topicId, Long entityId, BlogRole role, String externalSystemId, String externalObjectId) throws BlogNotFoundException, CommunoteEntityNotFoundException, ExternalObjectNotAssignedException, BlogAccessException
Add a member with the given role to the blog on the behalf of an external system. If the entity already is a member of the blog and was added on the behalf of the same external system, nothing will happen.
When adding a member on the behalf of an external system, the role will not interfere with roles added for other external systems or those that were not added for an external system (for instance by the blog manager via the web FE). Because of this a user can have different roles for the same blog. For such a case the actual access right will always be the highest of all the assigned rights.
It is assumed that the blog is associated with an external object from the external system. In case the blog is not associated with the external object identified by the externalObjectId an exception is thrown.
topicId
- ID of the blogentityId
- ID of a user or a grouprole
- the role describing the access right the entity should getexternalSystemId
- identifier of the external systemexternalObjectId
- identifier of the external object within the external systemCommunoteEntityNotFoundException
- in case the user or group does not existBlogNotFoundException
- in case the blog does not existExternalObjectNotAssignedException
- in case the external object is not assigned to the blogBlogAccessException
- in case the current user is not manager of the blogvoid addEntityForExternalTrusted(Long topicId, Long entityId, BlogRole role, String externalSystemId) throws BlogNotFoundException, CommunoteEntityNotFoundException, BlogAccessException
Add a member with the given role to the blog on the behalf of an external system. If the entity already is a member of the blog and was added on the behalf of the same external system, nothing will happen.
When adding a member on the behalf of an external system, the role will not interfere with roles added for other external systems or those that were not added for an external system (for instance by the blog manager via the web FE). Because of this a user can have different roles for the same blog. For such a case the actual access right will always be the highest of all the assigned rights.
It is assumed that the blog is associated with an external object from the external system. The 'Trusted' suffix in the method name denotes that the caller has to take care that there is such an external object. As of for now only the client manager is allowed to call this method.
topicId
- ID of the blogentityId
- ID of a user or a grouprole
- the role describing the access right the entity should getexternalSystemId
- identifier of the external systemCommunoteEntityNotFoundException
- in case the user or group does not existBlogNotFoundException
- in case the blog does not existBlogAccessException
- in case the current user is not client managervoid assignEntity(Long topicId, Long entityId, BlogRole role) throws BlogAccessException, BlogNotFoundException, CommunoteEntityNotFoundException, NoBlogManagerLeftException
Add a member with the given role to the blog. If the entity is already a member the role will be changed to the provided role. This method won't change a role that was added on the behalf of an external system.
topicId
- The topics id.entityId
- The entity to assign.role
- The role for the entity.BlogAccessException
BlogNotFoundException
CommunoteEntityNotFoundException
NoBlogManagerLeftException
void assignEntity(Long blogId, Long entityId, BlogRole role, boolean createNote) throws BlogAccessException, BlogNotFoundException, CommunoteEntityNotFoundException, NoBlogManagerLeftException
Adds member with the given role to the blog. If the entity already is a member of the blog, nothing will happen.
topicId
- ID of the blogentityId
- ID of a user or a grouprole
- the role describing the access right the entity should getcreateNote
- true to create the activity noteCommunoteEntityNotFoundException
- in case the user or group does not existBlogNotFoundException
- in case the blog does not existBlogAccessException
- in case the current user is not allowed to add an entity to the blog. This
exception won't be thrown during blog creation.NoBlogManagerLeftException
void assignEntityForExternal(Long topicId, Long entityId, BlogRole role, String externalSystemId, String externalObjectId) throws BlogAccessException, BlogNotFoundException, CommunoteEntityNotFoundException, ExternalObjectNotAssignedException
Add or update a member with the given role on the behalf of an external system.
This method first checks whether there is already a member that was added for the given
external system and if this is the case it behaves exactly like
changeRoleOfMemberByEntityIdForExternal(Long, Long, BlogRole, String)
, if it is not
the case it does the same as
addEntityForExternal(Long, Long, BlogRole, String, String)
topicId
- ID of the blogentityId
- ID of a user or a grouprole
- the role describing the access right the entity should getexternalSystemId
- identifier of the external systemexternalObjectId
- identifier of the external object within the external systemCommunoteEntityNotFoundException
- in case the user or group does not existBlogNotFoundException
- in case the blog does not existBlogAccessException
- in case the current user is not allowed to modify the blog access rightsExternalObjectNotAssignedException
- in case the entity is not yet a member and the external object is not associated
with the blogvoid assignEntityForExternalTrusted(Long topicId, Long entityId, BlogRole role, String externalSystemId) throws BlogAccessException, BlogNotFoundException, CommunoteEntityNotFoundException
Add or update a member with the given role on the behalf of an external system.
This method first checks whether there is already a member that was added for the given
external system and if this is the case it behaves exactly like
changeRoleOfMemberByEntityIdForExternal(Long, Long, BlogRole, String)
, if it is not
the case it does the same as
addEntityForExternalTrusted(Long, Long, BlogRole, String)
topicId
- ID of the blogentityId
- ID of a user or a grouprole
- the role describing the access right the entity should getexternalSystemId
- identifier of the external systemCommunoteEntityNotFoundException
- in case the user or group does not existBlogNotFoundException
- in case the blog does not existBlogAccessException
- in case the current user is not allowed to modify the blog access rightsvoid assignManagementAccessToCurrentUser(Long topicId) throws BlogNotFoundException, AuthorizationException
topicId
- The topics id.AuthorizationException
- in case the current user is not client managerBlogNotFoundException
- in case the topic does not existvoid changePublicAccess(Long topicId, boolean allowPublicAccess) throws BlogNotFoundException, BlogAccessException
Change the public access to a blog.
topicId
- ID of the blogallowPublicAccess
- if true the blog will also be accessible by the unauthorized public userBlogNotFoundException
- in case the blog does not existBlogAccessException
- in case the current user is not allowed to modify the blog access rightsvoid changeRoleOfMemberByEntityId(Long topicId, Long entityId, BlogRole role) throws BlogMemberNotFoundException, BlogNotFoundException, NoBlogManagerLeftException, BlogAccessException
Changes the role of a blog member. This method won't change the role of a member that was added on the behalf of an external system.
topicId
- ID of the blogentityId
- ID of a user or a group that has previously added to the blogrole
- the role describing the new access right the entity should getBlogNotFoundException
- in case the blog does not existNoBlogManagerLeftException
- in case the operation would remove the last active blog managerBlogAccessException
- in case the current user is not allowed to modify the blog access rightsBlogMemberNotFoundException
- in case the entity is not a member of the blogvoid changeRoleOfMemberByEntityIdForExternal(Long topicId, Long entityId, BlogRole role, String externalSystemId) throws BlogNotFoundException, BlogMemberNotFoundException, BlogAccessException
Change the role of a blog member that was added on the behalf of an external system. This method won't change the role of a member that was added on the behalf of another external system or that was added directly.
topicId
- ID of the blogentityId
- ID of a user or a group that has previously added to the blog on the behalf of the
external systemrole
- the role describing the new access right the entity should getBlogNotFoundException
- in case the blog does not existBlogMemberNotFoundException
- in case the entity is not a member of the blogBlogAccessException
- in case the current user is not allowed to modify the blog access rightsboolean currentUserHasManagementAccess(Long topicId)
Tests whether the current user is manager of a blog.
topicId
- ID of the blogboolean currentUserHasReadAccess(Long topicId, boolean ignoreAllCanFlags)
topicId
- ID of the blogignoreAllCanFlags
- ignore the all can read and all can write flags and only consider the individual
blog membersboolean currentUserHasWriteAccess(Long topicId, boolean ignoreAllCanFlags)
Tests whether the current user has write access to a blog.
topicId
- ID of the blogignoreAllCanFlags
- ignore the all can write flag and only consider the individual blog membersBlog getAndCheckBlogAccess(Long topicId, BlogRole blogRole) throws BlogNotFoundException, BlogAccessException
topicId
- the ID of the topic to retrieveblogRole
- the access rights the current user needs to haveBlogNotFoundException
- in case there is no topic with the given IDBlogAccessException
- in case the current user has no access to the topic<T> Collection<T> getMappedUsers(Long topicId, CollectionConverter<UserToBlogRoleMapping,T> converter, BlogRole... roles)
topicId
- Id of the topic the users are requested.converter
- An Converter for converting the found users to something else.roles
- The user must have at least one of these roles.BlogRole getRoleOfCurrentUser(Long topicId, boolean ignoreAllCanFlags)
BlogRole getRoleOfEntity(Long topicId, Long entityId, boolean ignoreAllCanFlags)
BlogRole getRoleOfUser(Long topicId, Long userId, boolean ignoreAllCanFlags)
boolean hasAnotherManager(Long topicId, Long userId)
Returns true if the blog has another active user as member with management access right.
boolean hasAnotherReader(Long topicId, Long userId)
Returns true if the blog has another reader than the user passed in.
boolean isEntityDirectMember(Long topicId, Long entityId)
Returns true if the entity was added to the blog. This will return false if the entity has blog access through other means like being member of a group that was added to the blog or the blog has allCanRead, allCanWrite access. If the entity has no blog access false will be returned as well.
void removeMemberByEntityId(Long topicId, Long entityId) throws NoBlogManagerLeftException, BlogNotFoundException, BlogAccessException
void removeMemberByEntityIdForExternal(Long topicId, Long entityId, String externalSystemId) throws BlogNotFoundException, BlogAccessException
topicId
- Id of the topic.entityId
- Id of the entity to remove.externalSystemId
- Id of the entities external system.BlogNotFoundException
BlogAccessException
void removeUserFromAllBlogs(Long userId, Collection<Long> blogsToNotCheckForLastManager) throws AuthorizationException, NoBlogManagerLeftException
Removes all the direct blog memberships of a user. If the user to remove is not the current user or the current user is not a client manager an AuthorizationException will be thrown. If the blog would end without mananger a NoBlogManagerLEftException is thrown.
Blog setAllCanReadAllCanWrite(Long topicId, boolean allCanRead, boolean allCanWrite) throws BlogAccessException, BlogNotFoundException
Update the blog all you can read /write only
boolean userHasManagementAccess(Long topicId, Long userId)
Test whether a user is manager of a blog.
topicId
- ID of the bloguserId
- identifier of userboolean userHasReadAccess(Long topicId, Long userId, boolean ignoreAllCanFlags)
Test whether a user has read access to a blog.
topicId
- ID of the bloguserId
- identifier of userignoreAllCanFlags
- ignore the all can read and all can write flags and only consider the individual
blog membersboolean userHasWriteAccess(Long topicId, Long userId, boolean ignoreAllCanFlags)
Tests whether a user has write access to a blog.
topicId
- ID of the bloguserId
- identifier of userignoreAllCanFlags
- ignore the flag all can writeCopyright © 2019 Communote team. All rights reserved.