Class PermissionsBasedAuthorityHolder
- java.lang.Object
-
- jetbrains.buildServer.serverSide.auth.PermissionsBasedAuthorityHolder
-
- All Implemented Interfaces:
AuthorityHolder
- Direct Known Subclasses:
BuildAuthorityHolderImpl
,MockAuthorityHolder
,PresignedTokenAuthorityHolderImpl
public abstract class PermissionsBasedAuthorityHolder extends Object implements AuthorityHolder
-
-
Constructor Summary
Constructors Constructor Description PermissionsBasedAuthorityHolder()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static PermissionsBasedAuthorityHolder
createWithGlobalPermissions(Permissions globalPermissions, String name)
Permissions
getGlobalPermissions()
Returns all granted non-project related permissions and all project-related permissions granted globallyPermissions
getPermissionsGrantedForAllProjects(Collection<String> projectIds)
Returns all permissions granted for all projects from the collection.Permissions
getPermissionsGrantedForAnyOfProjects(Collection<String> projectIds)
Returns union of permissions granted for projects from the collection.Permissions
getPermissionsGrantedForProject(String projectId)
Returns all permissions granted for particular project.protected abstract UnmodifiablePermissionsHolder
getPermissionsHolder()
Map<String,Permissions>
getProjectsPermissions()
Returns map of project-related permissions that were granted for a particular project.boolean
hasAllPermissionsOf(AuthorityHolder authorityHolder)
Returns true if this authority holder has all permissions of another authority holder.boolean
isPermissionGrantedForAllProjects(Collection<String> projectIds, Permission permission)
Returns true if permission is granted for all projects from the given list.boolean
isPermissionGrantedForAnyOfProjects(Collection<String> projectIds, Permission permission)
Returns true if specified permission is granted for at least one project from the given collectionboolean
isPermissionGrantedForAnyProject(Permission permission)
Returns true if specified permission is granted for at least one projectboolean
isPermissionGrantedForProject(String projectId, Permission permission)
Returns true if permission is granted for a project, i.e.boolean
isPermissionGrantedGlobally(Permission permission)
Returns true if specified permission granted globally (i.e.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.serverSide.auth.AuthorityHolder
getAllPermissions, getAssociatedUser
-
-
-
-
Method Detail
-
isPermissionGrantedGlobally
public boolean isPermissionGrantedGlobally(@NotNull Permission permission)
Description copied from interface:AuthorityHolder
Returns true if specified permission granted globally (i.e. not associated with any particular object)- Specified by:
isPermissionGrantedGlobally
in interfaceAuthorityHolder
- Parameters:
permission
- permission to check- Returns:
- true or false
-
isPermissionGrantedForProject
public boolean isPermissionGrantedForProject(@NotNull String projectId, @NotNull Permission permission)
Description copied from interface:AuthorityHolder
Returns true if permission is granted for a project, i.e. the result is true if there is a project related permission granted globally or for specified project- Specified by:
isPermissionGrantedForProject
in interfaceAuthorityHolder
- Parameters:
projectId
- project internal idpermission
- permission to check- Returns:
- see above
-
isPermissionGrantedForAnyProject
public boolean isPermissionGrantedForAnyProject(@NotNull Permission permission)
Description copied from interface:AuthorityHolder
Returns true if specified permission is granted for at least one project- Specified by:
isPermissionGrantedForAnyProject
in interfaceAuthorityHolder
- Parameters:
permission
- permission to check- Returns:
- see above
-
isPermissionGrantedForAnyOfProjects
public boolean isPermissionGrantedForAnyOfProjects(@NotNull Collection<String> projectIds, @NotNull Permission permission)
Description copied from interface:AuthorityHolder
Returns true if specified permission is granted for at least one project from the given collection- Specified by:
isPermissionGrantedForAnyOfProjects
in interfaceAuthorityHolder
permission
- permission to check- Returns:
- see above
-
isPermissionGrantedForAllProjects
public boolean isPermissionGrantedForAllProjects(@NotNull Collection<String> projectIds, @NotNull Permission permission)
Description copied from interface:AuthorityHolder
Returns true if permission is granted for all projects from the given list. Returns false if projectIds is empty.- Specified by:
isPermissionGrantedForAllProjects
in interfaceAuthorityHolder
- Parameters:
projectIds
- collection of project idspermission
- permission to check @return see above- See Also:
AuthorityHolder.isPermissionGrantedForProject(java.lang.String, jetbrains.buildServer.serverSide.auth.Permission)
-
getGlobalPermissions
@NotNull public Permissions getGlobalPermissions()
Description copied from interface:AuthorityHolder
Returns all granted non-project related permissions and all project-related permissions granted globally- Specified by:
getGlobalPermissions
in interfaceAuthorityHolder
- Returns:
- see above
-
getProjectsPermissions
@NotNull public Map<String,Permissions> getProjectsPermissions()
Description copied from interface:AuthorityHolder
Returns map of project-related permissions that were granted for a particular project. Project internal id is used as the key.- Specified by:
getProjectsPermissions
in interfaceAuthorityHolder
- Returns:
- map of project permissions
-
getPermissionsGrantedForProject
@NotNull public Permissions getPermissionsGrantedForProject(@NotNull String projectId)
Description copied from interface:AuthorityHolder
Returns all permissions granted for particular project. These include permissions granted specifically for the specified project and granted global project-related permissions (i.e. permissions supporting project associationPermission.isProjectAssociationSupported()
).- Specified by:
getPermissionsGrantedForProject
in interfaceAuthorityHolder
- Parameters:
projectId
- project internal id- Returns:
- all granted permissions for particular project
-
getPermissionsGrantedForAllProjects
@NotNull public Permissions getPermissionsGrantedForAllProjects(@NotNull Collection<String> projectIds)
Description copied from interface:AuthorityHolder
Returns all permissions granted for all projects from the collection. These include permissions granted specifically for the specified projects and granted global project-related permissions (i.e. permissions supporting project associationPermission.isProjectAssociationSupported()
).- Specified by:
getPermissionsGrantedForAllProjects
in interfaceAuthorityHolder
- Parameters:
projectIds
- collection of project internal ids- Returns:
- all granted permissions for all projects
-
getPermissionsGrantedForAnyOfProjects
@NotNull public Permissions getPermissionsGrantedForAnyOfProjects(@NotNull Collection<String> projectIds)
Description copied from interface:AuthorityHolder
Returns union of permissions granted for projects from the collection. These include permissions granted specifically for the specified projects and granted global project-related permissions (i.e. permissions supporting project associationPermission.isProjectAssociationSupported()
).- Specified by:
getPermissionsGrantedForAnyOfProjects
in interfaceAuthorityHolder
- Parameters:
projectIds
- collection of project internal ids- Returns:
- all granted permissions for all projects
-
hasAllPermissionsOf
public boolean hasAllPermissionsOf(@NotNull AuthorityHolder authorityHolder)
Description copied from interface:AuthorityHolder
Returns true if this authority holder has all permissions of another authority holder.- Specified by:
hasAllPermissionsOf
in interfaceAuthorityHolder
- Returns:
- see above
-
getPermissionsHolder
@NotNull protected abstract UnmodifiablePermissionsHolder getPermissionsHolder()
-
createWithGlobalPermissions
public static PermissionsBasedAuthorityHolder createWithGlobalPermissions(@NotNull Permissions globalPermissions, @Nullable String name)
-
-