@Transactional(propagation=REQUIRED) public abstract class BlogRightsManagementBase extends Object implements BlogRightsManagement
Spring Service base class for BlogRightsManagement
, provides access to all services
and entities referenced by this service.
BlogRightsManagement
Constructor and Description |
---|
BlogRightsManagementBase() |
Modifier and Type | Method and Description |
---|---|
void |
addEntity(Long blogId,
Long entityId,
BlogRole role)
Adds member with the given role to the blog.
|
void |
addEntityForExternal(Long blogId,
Long entityId,
BlogRole role,
String externalSystemId,
String externalId)
Add a member with the given role to the blog on the behalf of an external system.
|
void |
addEntityForExternalTrusted(Long blogId,
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 blogId,
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 blogId,
Long entityId,
BlogRole role,
String externalSystemId,
String externalId)
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 blogId)
Assigns the management role to the current user.
|
void |
changePublicAccess(Long blogId,
boolean allowPublicAccess)
Change the public access to a blog.
|
void |
changeRoleOfMemberByEntityId(Long blogId,
Long entityId,
BlogRole role)
Changes the role of a blog member.
|
void |
changeRoleOfMemberByEntityIdForExternal(Long blogId,
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 blogId)
Tests whether the current user is manager of a blog.
|
boolean |
currentUserHasReadAccess(Long blogId,
boolean ignoreAllCanFlags)
Tests whether the current user has read access to a blog.
|
boolean |
currentUserHasWriteAccess(Long blogId,
boolean ignoreAllCanFlags)
Tests whether the current user has write access to a blog.
|
Blog |
getAndCheckBlogAccess(Long blogId,
BlogRole blogRole)
Check if a topic exists and the current user has access to that topic.
|
protected Principal |
getPrincipal()
Gets the current
principal if one has been set, otherwise returns
null . |
BlogRole |
getRoleOfCurrentUser(Long blogId,
boolean ignoreAllCanFlags)
Returns the blog role of the current user.
|
BlogRole |
getRoleOfEntity(Long blogId,
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 blogId,
Long userId,
boolean ignoreAllCanFlags)
Returns the blog role of a user.
|
protected abstract void |
handleAddEntity(Long blogId,
Long entityId,
BlogRole role)
Performs the core logic for
addEntity(Long, Long, BlogRole) |
protected abstract void |
handleAddEntityForExternal(Long blogId,
Long entityId,
BlogRole role,
String externalSystemId,
String externalObjectId)
Performs the core logic for
addEntityForExternal(Long, Long, BlogRole, String
externalSystemId, String externalId ) |
protected abstract void |
handleAddEntityForExternalTrusted(Long blogId,
Long entityId,
BlogRole role,
String externalSystemId)
Performs the core logic for
addEntityForExternalTrusted(Long, Long, BlogRole, String) |
protected abstract void |
handleAssignEntity(Long blogId,
Long entityId,
BlogRole role)
Performs the core logic for
assignEntity(Long, Long, BlogRole) |
protected abstract void |
handleAssignEntity(Long blogId,
Long entityId,
BlogRole role,
boolean createNote)
Performs the core logic for
assignEntity(Long, Long, BlogRole, boolean) |
protected abstract void |
handleAssignEntityForExternal(Long topicId,
Long entityId,
BlogRole role,
String externalSystemId,
String externalId)
Handle the assign of an external entity role to an internal topic
|
protected abstract void |
handleAssignEntityForExternalTrusted(Long topicId,
Long entityId,
BlogRole role,
String externalSystemId) |
protected abstract void |
handleAssignManagementAccessToCurrentUser(Long blogId)
Performs the core logic for
assignManagementAccessToCurrentUser(Long) |
protected abstract void |
handleChangePublicAccess(Long blogId,
boolean allowPublicAccess)
Performs the core logic for
changePublicAccess(Long, boolean) |
protected abstract void |
handleChangeRoleOfMemberByEntityId(Long blogId,
Long entityId,
BlogRole role)
Performs the core logic for
changeRoleOfMemberByEntityId(Long, Long, BlogRole) |
protected abstract void |
handleChangeRoleOfMemberByEntityIdForExternal(Long blogId,
Long entityId,
BlogRole role,
String externalSystemId)
Performs the core logic for
changeRoleOfMemberByEntityIdForExternal(Long, Long, BlogRole, String) |
protected abstract boolean |
handleCurrentUserHasManagementAccess(Long blogId)
Performs the core logic for
currentUserHasManagementAccess(Long) |
protected abstract boolean |
handleCurrentUserHasReadAccess(Long blogId,
boolean ignoreAllCanFlags)
Performs the core logic for
currentUserHasReadAccess(Long, boolean) |
protected abstract boolean |
handleCurrentUserHasWriteAccess(Long blogId,
boolean ignoreAllCanFlags)
Performs the core logic for
currentUserHasWriteAccess(Long, boolean) |
protected abstract Blog |
handleGetAndCheckBlogAccess(Long blogId,
BlogRole blogRole)
Performs the core logic for
getAndCheckBlogAccess(Long, BlogRole) |
protected abstract BlogRole |
handleGetRoleOfCurrentUser(Long blogId,
boolean ignoreAllCanFlags)
Performs the core logic for
getRoleOfCurrentUser(Long, boolean) |
protected abstract BlogRole |
handleGetRoleOfEntity(Long blogId,
Long entityId,
boolean ignoreAllCanFlags)
Performs the core logic for
getRoleOfEntity(Long, Long, boolean) |
protected abstract BlogRole |
handleGetRoleOfUser(Long blogId,
Long userId,
boolean ignoreAllCanFlags)
Performs the core logic for
getRoleOfUser(Long, Long, boolean) |
protected abstract boolean |
handleHasAnotherManager(Long blogId,
Long userId)
Performs the core logic for
hasAnotherManager(Long, Long) |
protected abstract boolean |
handleHasAnotherReader(Long blogId,
Long userId)
Performs the core logic for
hasAnotherReader(Long, Long) |
protected abstract boolean |
handleIsEntityDirectMember(Long blogId,
Long entityId)
Performs the core logic for
isEntityDirectMember(Long, Long) |
protected abstract void |
handleRemoveMemberByEntityId(Long blogId,
Long entityId)
Performs the core logic for
removeMemberByEntityId(Long, Long) |
protected abstract void |
handleRemoveMemberByEntityIdForExternal(Long blogId,
Long entityId,
String externalSystemId)
Performs the core logic for
removeMemberByEntityIdForExternal(Long, Long, String) |
protected abstract void |
handleRemoveUserFromAllBlogs(Long userId,
Collection<Long> blogsToNotCheckForLastManager)
Performs the core logic for
#removeUserFromAllBlogs(Long, java.util.Collection |
protected abstract Blog |
handleSetAllCanReadAllCanWrite(Long blogId,
boolean allCanRead,
boolean allCanWrite)
Performs the core logic for
setAllCanReadAllCanWrite(Long, boolean, boolean) |
protected abstract boolean |
handleUserHasManagementAccess(Long blogId,
Long userId)
Performs the core logic for
userHasManagementAccess(Long, Long) |
protected abstract boolean |
handleUserHasReadAccess(Long blogId,
Long userId,
boolean ignoreAllCanFlags)
Performs the core logic for
userHasReadAccess(Long, Long, boolean) |
protected abstract boolean |
handleUserHasWriteAccess(Long blogId,
Long userId,
boolean ignoreAllCanFlags)
Performs the core logic for
userHasWriteAccess(Long, Long, boolean) |
boolean |
hasAnotherManager(Long blogId,
Long userId)
Returns true if the blog has another active user as member with management access right.
|
boolean |
hasAnotherReader(Long blogId,
Long userId)
Returns true if the blog has another reader than the user passed in.
|
boolean |
isEntityDirectMember(Long blogId,
Long entityId)
Returns true if the entity was added to the blog.
|
void |
removeMemberByEntityId(Long blogId,
Long entityId) |
void |
removeMemberByEntityIdForExternal(Long blogId,
Long entityId,
String externalSystemId) |
void |
removeUserFromAllBlogs(Long userId,
Collection<Long> blogsToNotCheckForLastManager)
Removes all the direct blog memberships of a user.
|
Blog |
setAllCanReadAllCanWrite(Long blogId,
boolean allCanRead,
boolean allCanWrite)
Update the blog all you can read /write only
|
boolean |
userHasManagementAccess(Long blogId,
Long userId)
Test whether a user is manager of a blog.
|
boolean |
userHasReadAccess(Long blogId,
Long userId,
boolean ignoreAllCanFlags)
Test whether a user has read access to a blog.
|
boolean |
userHasWriteAccess(Long blogId,
Long userId,
boolean ignoreAllCanFlags)
Tests whether a user has write access to a blog.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMappedUsers
public void addEntity(Long blogId, Long entityId, BlogRole role) throws CommunoteEntityNotFoundException, BlogNotFoundException, BlogAccessException
BlogRightsManagement
Adds member with the given role to the blog. If the entity already is a member of the blog, nothing will happen.
addEntity
in interface BlogRightsManagement
blogId
- 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.public void addEntityForExternal(Long blogId, Long entityId, BlogRole role, String externalSystemId, String externalId) 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.
addEntityForExternal
in interface BlogRightsManagement
blogId
- 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 systemexternalId
- identifier of the external object within the external systemBlogNotFoundException
- in case the blog does not existCommunoteEntityNotFoundException
- in case the user or group does not existExternalObjectNotAssignedException
- in case the external object is not assigned to the blogBlogAccessException
- in case the current user is not manager of the blogpublic void addEntityForExternalTrusted(Long blogId, Long entityId, BlogRole role, String externalSystemId) throws BlogNotFoundException, CommunoteEntityNotFoundException, BlogAccessException
BlogRightsManagement
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.
addEntityForExternalTrusted
in interface BlogRightsManagement
blogId
- 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 systemBlogNotFoundException
- in case the blog does not existCommunoteEntityNotFoundException
- in case the user or group does not existBlogAccessException
- in case the current user is not client managerpublic void assignEntity(Long blogId, 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.
assignEntity
in interface BlogRightsManagement
blogId
- The topics id.entityId
- The entity to assign.role
- The role for the entity.BlogAccessException
BlogNotFoundException
CommunoteEntityNotFoundException
NoBlogManagerLeftException
public 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.
assignEntity
in interface BlogRightsManagement
entityId
- ID of a user or a grouprole
- the role describing the access right the entity should getcreateNote
- true to create the activity noteBlogAccessException
- in case the current user is not allowed to add an entity to the blog. This
exception won't be thrown during blog creation.BlogNotFoundException
- in case the blog does not existCommunoteEntityNotFoundException
- in case the user or group does not existNoBlogManagerLeftException
public void assignEntityForExternal(Long blogId, Long entityId, BlogRole role, String externalSystemId, String externalId) throws BlogNotFoundException, CommunoteEntityNotFoundException, BlogAccessException, 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
BlogRightsManagement.changeRoleOfMemberByEntityIdForExternal(Long, Long, BlogRole, String)
, if it is not
the case it does the same as
BlogRightsManagement.addEntityForExternal(Long, Long, BlogRole, String, String)
assignEntityForExternal
in interface BlogRightsManagement
blogId
- 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 systemexternalId
- identifier of the external object within the external systemBlogNotFoundException
- in case the blog does not existCommunoteEntityNotFoundException
- in case the user or group 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 blogpublic void 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
BlogRightsManagement.changeRoleOfMemberByEntityIdForExternal(Long, Long, BlogRole, String)
, if it is not
the case it does the same as
BlogRightsManagement.addEntityForExternalTrusted(Long, Long, BlogRole, String)
assignEntityForExternalTrusted
in interface BlogRightsManagement
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 systemBlogAccessException
- in case the current user is not allowed to modify the blog access rightsBlogNotFoundException
- in case the blog does not existCommunoteEntityNotFoundException
- in case the user or group does not existpublic void assignManagementAccessToCurrentUser(Long blogId) throws BlogNotFoundException, AuthorizationException
assignManagementAccessToCurrentUser
in interface BlogRightsManagement
blogId
- The topics id.BlogNotFoundException
- in case the topic does not existAuthorizationException
- in case the current user is not client managerpublic void changePublicAccess(Long blogId, boolean allowPublicAccess) throws BlogNotFoundException, BlogAccessException
BlogRightsManagement
Change the public access to a blog.
changePublicAccess
in interface BlogRightsManagement
blogId
- 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 rightspublic void changeRoleOfMemberByEntityId(Long blogId, 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.
changeRoleOfMemberByEntityId
in interface BlogRightsManagement
blogId
- 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 getBlogMemberNotFoundException
- in case the entity is not a member of the blogBlogNotFoundException
- 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 rightspublic void changeRoleOfMemberByEntityIdForExternal(Long blogId, 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.
changeRoleOfMemberByEntityIdForExternal
in interface BlogRightsManagement
blogId
- 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 rights@Transactional(readOnly=true) public boolean currentUserHasManagementAccess(Long blogId)
Tests whether the current user is manager of a blog.
currentUserHasManagementAccess
in interface BlogRightsManagement
blogId
- ID of the blog@Transactional(readOnly=true) public boolean currentUserHasReadAccess(Long blogId, boolean ignoreAllCanFlags)
BlogRightsManagement
currentUserHasReadAccess
in interface BlogRightsManagement
blogId
- ID of the blogignoreAllCanFlags
- ignore the all can read and all can write flags and only consider the individual
blog membersBlogRightsManagement.currentUserHasReadAccess(Long, boolean)
@Transactional(readOnly=true) public boolean currentUserHasWriteAccess(Long blogId, boolean ignoreAllCanFlags)
BlogRightsManagement
Tests whether the current user has write access to a blog.
currentUserHasWriteAccess
in interface BlogRightsManagement
blogId
- ID of the blogignoreAllCanFlags
- ignore the all can write flag and only consider the individual blog membersBlogRightsManagement.currentUserHasWriteAccess(Long, boolean)
@Transactional(readOnly=true) public Blog getAndCheckBlogAccess(Long blogId, BlogRole blogRole) throws BlogNotFoundException, BlogAccessException
BlogRightsManagement
getAndCheckBlogAccess
in interface BlogRightsManagement
blogId
- 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 topicBlogRightsManagement.getAndCheckBlogAccess(Long, BlogRole)
protected Principal getPrincipal()
principal
if one has been set, otherwise returns
null
.@Transactional(readOnly=true) public BlogRole getRoleOfCurrentUser(Long blogId, boolean ignoreAllCanFlags)
BlogRightsManagement
getRoleOfCurrentUser
in interface BlogRightsManagement
BlogRightsManagement.getRoleOfCurrentUser(Long, boolean)
@Transactional(readOnly=true) public BlogRole getRoleOfEntity(Long blogId, Long entityId, boolean ignoreAllCanFlags)
BlogRightsManagement
getRoleOfEntity
in interface BlogRightsManagement
BlogRightsManagement.getRoleOfEntity(Long, Long, boolean)
@Transactional(readOnly=true) public BlogRole getRoleOfUser(Long blogId, Long userId, boolean ignoreAllCanFlags)
BlogRightsManagement
getRoleOfUser
in interface BlogRightsManagement
BlogRightsManagement.getRoleOfUser(Long, Long, boolean)
protected abstract void handleAddEntity(Long blogId, Long entityId, BlogRole role) throws CommunoteEntityNotFoundException, BlogNotFoundException, BlogAccessException
addEntity(Long, Long, BlogRole)
protected abstract void handleAddEntityForExternal(Long blogId, Long entityId, BlogRole role, String externalSystemId, String externalObjectId) throws BlogNotFoundException, CommunoteEntityNotFoundException, ExternalObjectNotAssignedException, BlogAccessException
addEntityForExternal(Long, Long, BlogRole, String
externalSystemId, String externalId )
blogId
- 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 blogprotected abstract void handleAddEntityForExternalTrusted(Long blogId, Long entityId, BlogRole role, String externalSystemId) throws BlogNotFoundException, CommunoteEntityNotFoundException, BlogAccessException
addEntityForExternalTrusted(Long, Long, BlogRole, String)
blogId
- 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 add the entityprotected abstract void handleAssignEntity(Long blogId, Long entityId, BlogRole role) throws BlogAccessException, BlogNotFoundException, CommunoteEntityNotFoundException, NoBlogManagerLeftException
assignEntity(Long, Long, BlogRole)
protected abstract void handleAssignEntity(Long blogId, Long entityId, BlogRole role, boolean createNote) throws BlogAccessException, BlogNotFoundException, CommunoteEntityNotFoundException, NoBlogManagerLeftException
assignEntity(Long, Long, BlogRole, boolean)
protected abstract void handleAssignEntityForExternal(Long topicId, Long entityId, BlogRole role, String externalSystemId, String externalId) throws BlogAccessException, BlogNotFoundException, CommunoteEntityNotFoundException, ExternalObjectNotAssignedException
topicId
- identifier of topicentityId
- user or group identifierrole
- of externalexternalSystemId
- identifier of external systemexternalId
- identifier of external object in external systemCommunoteEntityNotFoundException
- can not found user BlogAccessExceptionBlogNotFoundException
- can not found topicBlogAccessException
- can not access topicExternalObjectNotAssignedException
- external object is not assigned to topicprotected abstract void handleAssignEntityForExternalTrusted(Long topicId, Long entityId, BlogRole role, String externalSystemId) throws BlogAccessException, BlogNotFoundException, CommunoteEntityNotFoundException
protected abstract void handleAssignManagementAccessToCurrentUser(Long blogId) throws BlogNotFoundException, AuthorizationException
assignManagementAccessToCurrentUser(Long)
protected abstract void handleChangePublicAccess(Long blogId, boolean allowPublicAccess) throws BlogNotFoundException, BlogAccessException
changePublicAccess(Long, boolean)
protected abstract void handleChangeRoleOfMemberByEntityId(Long blogId, Long entityId, BlogRole role) throws BlogMemberNotFoundException, BlogNotFoundException, NoBlogManagerLeftException, BlogAccessException
changeRoleOfMemberByEntityId(Long, Long, BlogRole)
protected abstract void handleChangeRoleOfMemberByEntityIdForExternal(Long blogId, Long entityId, BlogRole role, String externalSystemId) throws BlogNotFoundException, BlogMemberNotFoundException, BlogAccessException
changeRoleOfMemberByEntityIdForExternal(Long, Long, BlogRole, String)
protected abstract boolean handleCurrentUserHasManagementAccess(Long blogId)
currentUserHasManagementAccess(Long)
protected abstract boolean handleCurrentUserHasReadAccess(Long blogId, boolean ignoreAllCanFlags)
currentUserHasReadAccess(Long, boolean)
protected abstract boolean handleCurrentUserHasWriteAccess(Long blogId, boolean ignoreAllCanFlags)
currentUserHasWriteAccess(Long, boolean)
protected abstract Blog handleGetAndCheckBlogAccess(Long blogId, BlogRole blogRole) throws BlogNotFoundException, BlogAccessException
getAndCheckBlogAccess(Long, BlogRole)
protected abstract BlogRole handleGetRoleOfCurrentUser(Long blogId, boolean ignoreAllCanFlags)
getRoleOfCurrentUser(Long, boolean)
protected abstract BlogRole handleGetRoleOfEntity(Long blogId, Long entityId, boolean ignoreAllCanFlags)
getRoleOfEntity(Long, Long, boolean)
protected abstract BlogRole handleGetRoleOfUser(Long blogId, Long userId, boolean ignoreAllCanFlags)
getRoleOfUser(Long, Long, boolean)
protected abstract boolean handleHasAnotherManager(Long blogId, Long userId)
hasAnotherManager(Long, Long)
protected abstract boolean handleHasAnotherReader(Long blogId, Long userId)
hasAnotherReader(Long, Long)
protected abstract boolean handleIsEntityDirectMember(Long blogId, Long entityId)
isEntityDirectMember(Long, Long)
protected abstract void handleRemoveMemberByEntityId(Long blogId, Long entityId) throws NoBlogManagerLeftException, BlogNotFoundException, BlogAccessException
removeMemberByEntityId(Long, Long)
protected abstract void handleRemoveMemberByEntityIdForExternal(Long blogId, Long entityId, String externalSystemId) throws BlogNotFoundException, BlogAccessException
removeMemberByEntityIdForExternal(Long, Long, String)
protected abstract void handleRemoveUserFromAllBlogs(Long userId, Collection<Long> blogsToNotCheckForLastManager) throws AuthorizationException, NoBlogManagerLeftException
#removeUserFromAllBlogs(Long, java.util.Collection)
protected abstract Blog handleSetAllCanReadAllCanWrite(Long blogId, boolean allCanRead, boolean allCanWrite) throws BlogAccessException, BlogNotFoundException
setAllCanReadAllCanWrite(Long, boolean, boolean)
protected abstract boolean handleUserHasManagementAccess(Long blogId, Long userId)
userHasManagementAccess(Long, Long)
protected abstract boolean handleUserHasReadAccess(Long blogId, Long userId, boolean ignoreAllCanFlags)
userHasReadAccess(Long, Long, boolean)
protected abstract boolean handleUserHasWriteAccess(Long blogId, Long userId, boolean ignoreAllCanFlags)
userHasWriteAccess(Long, Long, boolean)
@Transactional(readOnly=true) public boolean hasAnotherManager(Long blogId, Long userId)
BlogRightsManagement
Returns true if the blog has another active user as member with management access right.
hasAnotherManager
in interface BlogRightsManagement
BlogRightsManagement.hasAnotherManager(Long, Long)
@Transactional(readOnly=true) public boolean hasAnotherReader(Long blogId, Long userId)
BlogRightsManagement
Returns true if the blog has another reader than the user passed in.
hasAnotherReader
in interface BlogRightsManagement
BlogRightsManagement.hasAnotherReader(Long, Long)
@Transactional(readOnly=true) public boolean isEntityDirectMember(Long blogId, Long entityId)
BlogRightsManagement
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.
isEntityDirectMember
in interface BlogRightsManagement
BlogRightsManagement.isEntityDirectMember(Long, Long)
public void removeMemberByEntityId(Long blogId, Long entityId) throws NoBlogManagerLeftException, BlogNotFoundException, BlogAccessException
removeMemberByEntityId
in interface BlogRightsManagement
NoBlogManagerLeftException
BlogNotFoundException
BlogAccessException
BlogRightsManagement.removeMemberByEntityId(Long, Long)
public void removeMemberByEntityIdForExternal(Long blogId, Long entityId, String externalSystemId) throws BlogNotFoundException, BlogAccessException
removeMemberByEntityIdForExternal
in interface BlogRightsManagement
blogId
- Id of the topic.entityId
- Id of the entity to remove.externalSystemId
- Id of the entities external system.BlogNotFoundException
BlogAccessException
BlogRightsManagement.removeMemberByEntityIdForExternal(Long, Long, String)
public void removeUserFromAllBlogs(Long userId, Collection<Long> blogsToNotCheckForLastManager) throws AuthorizationException, NoBlogManagerLeftException
BlogRightsManagement
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.
removeUserFromAllBlogs
in interface BlogRightsManagement
AuthorizationException
NoBlogManagerLeftException
BlogRightsManagement#removeUserFromAllBlogs(java .lang.Long, java.util.Collection)
public Blog setAllCanReadAllCanWrite(Long blogId, boolean allCanRead, boolean allCanWrite) throws BlogAccessException, BlogNotFoundException
BlogRightsManagement
Update the blog all you can read /write only
setAllCanReadAllCanWrite
in interface BlogRightsManagement
BlogAccessException
BlogNotFoundException
BlogRightsManagement.setAllCanReadAllCanWrite(Long, boolean, boolean)
@Transactional(readOnly=true) public boolean userHasManagementAccess(Long blogId, Long userId)
BlogRightsManagement
Test whether a user is manager of a blog.
userHasManagementAccess
in interface BlogRightsManagement
blogId
- ID of the bloguserId
- identifier of userBlogRightsManagement.userHasManagementAccess(Long, Long)
@Transactional(readOnly=true) public boolean userHasReadAccess(Long blogId, Long userId, boolean ignoreAllCanFlags)
BlogRightsManagement
Test whether a user has read access to a blog.
userHasReadAccess
in interface BlogRightsManagement
blogId
- ID of the bloguserId
- identifier of userignoreAllCanFlags
- ignore the all can read and all can write flags and only consider the individual
blog membersBlogRightsManagement.userHasReadAccess(Long, Long, boolean)
@Transactional(readOnly=true) public boolean userHasWriteAccess(Long blogId, Long userId, boolean ignoreAllCanFlags)
BlogRightsManagement
Tests whether a user has write access to a blog.
userHasWriteAccess
in interface BlogRightsManagement
blogId
- identifier of topicuserId
- identifier of userignoreAllCanFlags
- ignore all can read or writeBlogRightsManagement.userHasWriteAccess(Long, Long, boolean)
Copyright © 2019 Communote team. All rights reserved.