Class AuthorizationFunctions
- java.lang.Object
-
- jetbrains.buildServer.web.functions.auth.AuthorizationFunctions
-
public class AuthorizationFunctions extends Object
A set of functions for permissions checking that can be called from JSP.
-
-
Constructor Summary
Constructors Constructor Description AuthorizationFunctions(SecurityContext context)
Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
adminSpaceAvailable()
Returns true if currently authenticated user has access to the administration space (can see "Administration" tab in the web UI).static boolean
canCancelBuild(SQueuedBuild queuedBuild)
Returns true if current authority holder can cancel queued buildstatic boolean
canEditVcsChange(SVcsModification modification)
Returns true if current authority holder can edit vcs modificationstatic boolean
canEditVcsRoot(SVcsRoot vcsRoot)
Returns true if current authority holder can edit VCS rootstatic boolean
canRemoveBuild(SBuild build)
Returns true if current authority holder can remove buildstatic boolean
canStopBuild(SBuild build)
Returns true if current authority holder can stop buildstatic boolean
canViewAgentDetailsInPool(AgentPool agentPool)
Returns true if current authority holder can view details of agents in specified poolstatic boolean
canViewAgentPool(AgentPool agentPool)
Returns true if current authority holder can view agents in specified poolstatic boolean
groupManagementAvailable()
Returns true if group management UI is available to current authority holderstatic boolean
hasFileContentAccess(SVcsModification modification)
Returns true if currently authenticated user has view file content permission granted for specified VCS modification or any of its duplicatesstatic boolean
isSystemAdmin()
Returns true if current authenticated user is a system adminstatic boolean
permissionGrantedForAnyProject(String permissionName)
Returns true if currently authenticated user has permission with specified name granted for any projectstatic boolean
permissionGrantedForBuild(SBuild build, String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified buildstatic boolean
permissionGrantedForBuildTemplate(BuildTypeTemplate buildTemplate, String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified build configuration templatestatic boolean
permissionGrantedForBuildType(SBuildType buildType, String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified build configurationstatic boolean
permissionGrantedForModification(SVcsModification modification, String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified VCS modificationstatic boolean
permissionGrantedForProject(SProject project, String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified projectstatic boolean
permissionGrantedForProjectWithId(String projectId, String permissionName)
Returns true if specified permission granted for the project with specified idstatic boolean
permissionGrantedGlobally(String permissionName)
Returns true if currently authenticated user has specified permission granted for all projectsstatic boolean
userManagementAvailable()
Returns true if user management UI is available to current authority holder
-
-
-
Constructor Detail
-
AuthorizationFunctions
public AuthorizationFunctions(@NotNull SecurityContext context)
Constructor.- Parameters:
context
- security context
-
-
Method Detail
-
permissionGrantedGlobally
public static boolean permissionGrantedGlobally(@NotNull String permissionName)
Returns true if currently authenticated user has specified permission granted for all projects- Parameters:
permissionName
- name of the permissionEnum.name()
- Returns:
- true if permission is granted and false otherwise
-
permissionGrantedForProject
public static boolean permissionGrantedForProject(@NotNull SProject project, @NotNull String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified project- Parameters:
project
- a projectpermissionName
- name of the permissionEnum.name()
- Returns:
- true if permission is granted and false otherwise
-
permissionGrantedForProjectWithId
public static boolean permissionGrantedForProjectWithId(@NotNull String projectId, @NotNull String permissionName)
Returns true if specified permission granted for the project with specified id- Parameters:
projectId
- id of the projectpermissionName
- name of the permissionEnum.name()
- Returns:
- true if permission is granted and false otherwise
-
permissionGrantedForAnyProject
public static boolean permissionGrantedForAnyProject(@NotNull String permissionName)
Returns true if currently authenticated user has permission with specified name granted for any project- Parameters:
permissionName
- name of the permissionEnum.name()
- Returns:
- true if permission is granted and false otherwise
-
permissionGrantedForBuildTemplate
public static boolean permissionGrantedForBuildTemplate(@NotNull BuildTypeTemplate buildTemplate, @NotNull String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified build configuration template- Parameters:
buildTemplate
- build configuration templatepermissionName
- name of the permissionEnum.name()
- Returns:
- true if permission is granted and false otherwise
-
permissionGrantedForBuildType
public static boolean permissionGrantedForBuildType(@NotNull SBuildType buildType, @NotNull String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified build configuration- Parameters:
buildType
- build configurationpermissionName
- name of the permissionEnum.name()
- Returns:
- true if permission is granted and false otherwise
-
permissionGrantedForBuild
public static boolean permissionGrantedForBuild(@NotNull SBuild build, @NotNull String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified build- Parameters:
build
- a buildpermissionName
- name of the permissionEnum.name()
- Returns:
- true if permission is granted and false otherwise
-
permissionGrantedForModification
public static boolean permissionGrantedForModification(@NotNull SVcsModification modification, @NotNull String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified VCS modification- Parameters:
modification
- VCS modificationpermissionName
- name of the permissionEnum.name()
- Returns:
- true if permission is granted and false otherwise
-
hasFileContentAccess
public static boolean hasFileContentAccess(@NotNull SVcsModification modification)
Returns true if currently authenticated user has view file content permission granted for specified VCS modification or any of its duplicates- Parameters:
modification
- VCS modification- Returns:
- see above
-
adminSpaceAvailable
public static boolean adminSpaceAvailable()
Returns true if currently authenticated user has access to the administration space (can see "Administration" tab in the web UI).- Returns:
- true if currently authenticated user has access to the administration space
-
userManagementAvailable
public static boolean userManagementAvailable()
Returns true if user management UI is available to current authority holder- Returns:
- see above
-
groupManagementAvailable
public static boolean groupManagementAvailable()
Returns true if group management UI is available to current authority holder- Returns:
- true if group management interface is available
-
canEditVcsRoot
public static boolean canEditVcsRoot(@NotNull SVcsRoot vcsRoot)
Returns true if current authority holder can edit VCS root- Parameters:
vcsRoot
- vcs root- Returns:
- see above
-
canRemoveBuild
public static boolean canRemoveBuild(@NotNull SBuild build)
Returns true if current authority holder can remove build- Parameters:
build
- build- Returns:
- see above
-
canEditVcsChange
public static boolean canEditVcsChange(@NotNull SVcsModification modification)
Returns true if current authority holder can edit vcs modification- Returns:
- see above
-
canStopBuild
public static boolean canStopBuild(@NotNull SBuild build)
Returns true if current authority holder can stop build- Parameters:
build
- build- Returns:
- see above
-
canCancelBuild
public static boolean canCancelBuild(@NotNull SQueuedBuild queuedBuild)
Returns true if current authority holder can cancel queued build- Parameters:
queuedBuild
- queued build- Returns:
- see above
-
canViewAgentPool
public static boolean canViewAgentPool(@NotNull AgentPool agentPool)
Returns true if current authority holder can view agents in specified pool- Parameters:
agentPool
- agent pool- Returns:
- see above
-
canViewAgentDetailsInPool
public static boolean canViewAgentDetailsInPool(@NotNull AgentPool agentPool)
Returns true if current authority holder can view details of agents in specified pool- Parameters:
agentPool
- agent pool- Returns:
- see above
-
isSystemAdmin
public static boolean isSystemAdmin()
Returns true if current authenticated user is a system admin- Returns:
- true if current authenticated user is a system admin
-
-