Class PermissionsHolder
- java.lang.Object
-
- jetbrains.buildServer.serverSide.auth.PermissionsHolder
-
- Direct Known Subclasses:
DerivedPermissionsAwarePermissionsHolder
public class PermissionsHolder extends Object
Encapsulates permission checking logic. Global permissions are those that are not associated with any project. Project permissions are associated with a project (via project id).
-
-
Constructor Summary
Constructors Constructor Description PermissionsHolder()Default constructorPermissionsHolder(AuthorityHolder authorityHolder)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PermissionsgetGlobalPermissions()Returns permissions granted globallyPermissionsgetPermissionsGrantedForAllProjects(Collection<String> projectIds)Returns intersection of permissions granted to the specified projectsPermissionsgetPermissionsGrantedForAnyOfProjects(Collection<String> projectIds)Returns union of permissions granted to the specified projectsPermissionsgetPermissionsGrantedForProject(String projectId)Returns permissions granted to the specified projectMap<String,Permissions>getProjectsPermissions()Returns permissions granted to projectsbooleanisPermissionGrantedForAllProjects(Collection<String> projectIds, Permission permission)booleanisPermissionGrantedForAnyOfProjects(Collection<String> projectIds, Permission permission)Returns true if the specified permission is granted to at least one project from the given collection.booleanisPermissionGrantedForAnyProject(Permission permission)Returns true if the specified permission is granted to at least one project.booleanisPermissionGrantedForProject(String projectId, Permission permission)Returns true if the specified permission is granted to the project with specified id.booleanisPermissionGrantedGlobally(Permission permission)Returns true if the specified permission is granted globally, i.e.voidsetPermissions(Permissions globalPermissions, Map<String,Permissions> projectPermissions)Sets global and project permissions in the holder
-
-
-
Constructor Detail
-
PermissionsHolder
public PermissionsHolder()
Default constructor
-
PermissionsHolder
@Deprecated public PermissionsHolder(@NotNull AuthorityHolder authorityHolder)
Deprecated.Copies permissions from the specified authority holder- Parameters:
authorityHolder- authority holder
-
-
Method Detail
-
setPermissions
public void setPermissions(@NotNull Permissions globalPermissions, @NotNull Map<String,Permissions> projectPermissions)Sets global and project permissions in the holder- Parameters:
globalPermissions- global permissionsprojectPermissions- project permissions map (internal projects id - permissions to set)
-
isPermissionGrantedGlobally
public boolean isPermissionGrantedGlobally(@NotNull Permission permission)Returns true if the specified permission is granted globally, i.e. the permission is granted and cannot be associated with a project (not project related permission) or is granted to all of the projects.- Parameters:
permission- permission to check- Returns:
- true if permission granted globally
-
isPermissionGrantedForProject
public boolean isPermissionGrantedForProject(@NotNull String projectId, @NotNull Permission permission)Returns true if the specified permission is granted to the project with specified id.- Parameters:
projectId- internal id of the projectpermission- permission to check- Returns:
- see above
-
isPermissionGrantedForAnyProject
public boolean isPermissionGrantedForAnyProject(@NotNull Permission permission)Returns true if the specified permission is granted to at least one project.- Parameters:
permission- permission to check- Returns:
- see above
-
isPermissionGrantedForAnyOfProjects
public boolean isPermissionGrantedForAnyOfProjects(Collection<String> projectIds, Permission permission)
Returns true if the specified permission is granted to at least one project from the given collection.- Parameters:
permission- permission to check- Returns:
- see above
-
isPermissionGrantedForAllProjects
public boolean isPermissionGrantedForAllProjects(Collection<String> projectIds, @NotNull Permission permission)
-
getGlobalPermissions
@NotNull public Permissions getGlobalPermissions()
Returns permissions granted globally- Returns:
- permissions granted globally
-
getProjectsPermissions
@NotNull public Map<String,Permissions> getProjectsPermissions()
Returns permissions granted to projects- Returns:
- permissions granted to projects
-
getPermissionsGrantedForProject
@NotNull public Permissions getPermissionsGrantedForProject(@NotNull String projectId)
Returns permissions granted to the specified project- Parameters:
projectId- internal id of the project- Returns:
- see above
-
getPermissionsGrantedForAllProjects
@NotNull public Permissions getPermissionsGrantedForAllProjects(@NotNull Collection<String> projectIds)
Returns intersection of permissions granted to the specified projects- Parameters:
projectIds- internal ids of the projects- Returns:
- see above
-
getPermissionsGrantedForAnyOfProjects
@NotNull public Permissions getPermissionsGrantedForAnyOfProjects(@NotNull Collection<String> projectIds)
Returns union of permissions granted to the specified projects- Parameters:
projectIds- internal ids of the projects- Returns:
- see above
-
-