Package com.qfs.security
Interface IBranchPermissionsManager
- All Known Implementing Classes:
BranchPermissionsManager,CachedBranchPermissionsManager,ContentServiceBranchPermissionsManager
public interface IBranchPermissionsManager
A service which keeps track of branch permissions: owner and reader rights.
In the context of what-if scenarios, ActivePivot may be configured to only allow a subset of users to create branches, edit or simply read the content of the datastore on specific branches. This applies to ReST calls (for create-write-read permissions) and MDX queries (for read permissions).
- Author:
- ActiveViam
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanCreateBranch(Set<String> userNameAndRoles) Given their username and their roles, returnstrueif the current user can create a branch,falseotherwise.default booleancanDeleteBranch(Set<String> userNameAndRoles, String branchName) Given their username and their roles, returnstrueif the current user can delete the given branch,falseotherwise.default booleancanEditBranch(Set<String> userNameAndRoles, String branchName) Given their username and their roles, returnstrueif the current user can edit the given branch,falseotherwise.default booleancanReadBranch(Set<String> userNameAndRoles, String branchName) Given their username and their roles, returnstrueif the current user can read the given branch,falseotherwise.getBranchPermissions(String branchName) Gets the permissions of a specific branch.getOwnedBranches(Set<String> userRoles) Gets the set of branches (registered in this service) that the user with the given roles own.getReadableBranches(Set<String> userRoles) Gets the set of branches (registered in this service) that the given roles can read.static booleanHelper method to be used when checking user permissions outside of thecanEditBranch(Set, String),canDeleteBranch(Set, String)andcanReadBranch(Set, String)methods.voidregisterBranchPermissionsListener(IBranchPermissionsListener branchPermissionsListener) Registers a listener for the permissions of a set of branches.voidremoveBranchPermissions(String branchName) Removes the branch's permissions from the service.voidsetBranchPermissions(String branchName, IBranchPermissions permissions) Sets the permissions of a specific branch.voidunregisterBranchPermissionsListener(IBranchPermissionsListener branchPermissionsListener) Unregisters a listener for the permissions of a set of branches.
-
Method Details
-
canCreateBranch
Given their username and their roles, returnstrueif the current user can create a branch,falseotherwise.- Parameters:
userNameAndRoles- the current user's set of roles/name- Returns:
trueif the current user can create a branch,falseotherwise
-
canEditBranch
Given their username and their roles, returnstrueif the current user can edit the given branch,falseotherwise.- Parameters:
userNameAndRoles- the current user's set of roles/namebranchName- the branch the user wants to edit- Returns:
trueif the current user can edit the branch,falseotherwise
-
canReadBranch
Given their username and their roles, returnstrueif the current user can read the given branch,falseotherwise. A user with write access has, by default, read access as well.- Parameters:
userNameAndRoles- the current user's set of roles/namebranchName- the branch the user wants to read- Returns:
trueif the current user can read the branch,falseotherwise
-
hasAccess
Helper method to be used when checking user permissions outside of thecanEditBranch(Set, String),canDeleteBranch(Set, String)andcanReadBranch(Set, String)methods. It takes care of the possible edge cases with special constants (seeIBranchPermissions.ALL_USERS_ALLOWED).- Parameters:
userNameAndRoles- the given user's set of roles/nameauthorizedUsers- the roles/names which are allowed for the permission we wish to check- Returns:
trueif the user complies with the user restrictions described with the authorizations,falseotherwise
-
canDeleteBranch
Given their username and their roles, returnstrueif the current user can delete the given branch,falseotherwise.- Parameters:
userNameAndRoles- the current user's set of roles/namebranchName- the branch the user wants to delete- Returns:
trueif the current user can delete the branch,falseotherwise
-
removeBranchPermissions
Removes the branch's permissions from the service. The default permissions for this manager will become the new permissions of this branch.- Parameters:
branchName- the name of the branch which will be removed
-
getBranchPermissions
Gets the permissions of a specific branch.- Parameters:
branchName- the name of the branch of which we want to know the permissions- Returns:
- the permissions for this branch
-
getOwnedBranches
Gets the set of branches (registered in this service) that the user with the given roles own.- Parameters:
userRoles- the given user's authorized roles- Returns:
- the set of branches (registered in this service) that the user with the given roles owns
-
getReadableBranches
Gets the set of branches (registered in this service) that the given roles can read.- Parameters:
userRoles- the given user's authorized roles- Returns:
- the set of branches (registered in this service) that the given user can read
-
setBranchPermissions
Sets the permissions of a specific branch.- Parameters:
branchName- the name of the branch of which we want to edit the permissionspermissions- the updated permissions for this branch
-
registerBranchPermissionsListener
Registers a listener for the permissions of a set of branches.- Parameters:
branchPermissionsListener- the listener which should be registered
-
unregisterBranchPermissionsListener
Unregisters a listener for the permissions of a set of branches.- Parameters:
branchPermissionsListener- the listener which should be unregistered
-