jetbrains.buildServer.web.functions.auth
Class AuthorizationFunctions

java.lang.Object
  extended by jetbrains.buildServer.web.functions.auth.AuthorizationFunctions

public class AuthorizationFunctions
extends java.lang.Object

A set of functions for permissions checking that can be called from JSP.


Constructor Summary
AuthorizationFunctions(SecurityContext context)
          Constructor.
 
Method Summary
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 canEditVcsRoot(SVcsRoot vcsRoot)
          Returns true if current authority holder can edit VCS root
static boolean canRemoveBuild(SBuild build)
          Returns true if current authority holder can remove build
static boolean canStopBuild(SBuild build)
          Returns true if current authority holder can stop build
static boolean groupManagementAvailable()
          Returns true if group management UI is available to current authority holder
static boolean hasFileContentAccess(SVcsModification modification)
          Returns true if currently authenticated user has view file content permission granted for specified VCS modification or any of its duplicates
static boolean isSystemAdmin()
          Returns true if current authenticated user is a system admin
static boolean permissionGrantedForAnyProject(java.lang.String permissionName)
          Returns true if currently authenticated user has permission with specified name granted for any project
static boolean permissionGrantedForBuild(SBuild build, java.lang.String permissionName)
          Returns true if currently authenticated user has permission with specified name granted for specified build
static boolean permissionGrantedForBuildType(SBuildType buildType, java.lang.String permissionName)
          Returns true if currently authenticated user has permission with specified name granted for specified build configuration
static boolean permissionGrantedForModification(SVcsModification modification, java.lang.String permissionName)
          Returns true if currently authenticated user has permission with specified name granted for specified VCS modification
static boolean permissionGrantedForProject(SProject project, java.lang.String permissionName)
          Returns true if currently authenticated user has permission with specified name granted for specified project
static boolean permissionGrantedForProjectWithId(java.lang.String projectId, java.lang.String permissionName)
          Returns true if specified permission granted for the project with specified id
static boolean permissionGrantedGlobally(java.lang.String permissionName)
          Returns true if currently authenticated user has specified permission granted for all projects
static boolean userManagementAvailable()
          Returns true if user management UI is available to current authority holder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthorizationFunctions

public AuthorizationFunctions(@NotNull
                              SecurityContext context)
Constructor.

Parameters:
context - security context
Method Detail

permissionGrantedGlobally

public static boolean permissionGrantedGlobally(@NotNull
                                                java.lang.String permissionName)
Returns true if currently authenticated user has specified permission granted for all projects

Parameters:
permissionName - name of the permission Enum.name
Returns:
true if permission is granted and false otherwise

permissionGrantedForProject

public static boolean permissionGrantedForProject(@NotNull
                                                  SProject project,
                                                  @NotNull
                                                  java.lang.String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified project

Parameters:
project - a project
permissionName - name of the permission Enum.name
Returns:
true if permission is granted and false otherwise

permissionGrantedForProjectWithId

public static boolean permissionGrantedForProjectWithId(@NotNull
                                                        java.lang.String projectId,
                                                        @NotNull
                                                        java.lang.String permissionName)
Returns true if specified permission granted for the project with specified id

Parameters:
projectId - id of the project
permissionName - name of the permission Enum.name
Returns:
true if permission is granted and false otherwise

permissionGrantedForAnyProject

public static boolean permissionGrantedForAnyProject(@NotNull
                                                     java.lang.String permissionName)
Returns true if currently authenticated user has permission with specified name granted for any project

Parameters:
permissionName - name of the permission Enum.name
Returns:
true if permission is granted and false otherwise

permissionGrantedForBuildType

public static boolean permissionGrantedForBuildType(@NotNull
                                                    SBuildType buildType,
                                                    @NotNull
                                                    java.lang.String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified build configuration

Parameters:
buildType - build configuration
permissionName - name of the permission Enum.name
Returns:
true if permission is granted and false otherwise

permissionGrantedForBuild

public static boolean permissionGrantedForBuild(@NotNull
                                                SBuild build,
                                                @NotNull
                                                java.lang.String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified build

Parameters:
build - a build
permissionName - name of the permission Enum.name
Returns:
true if permission is granted and false otherwise

permissionGrantedForModification

public static boolean permissionGrantedForModification(@NotNull
                                                       SVcsModification modification,
                                                       @NotNull
                                                       java.lang.String permissionName)
Returns true if currently authenticated user has permission with specified name granted for specified VCS modification

Parameters:
modification - VCS modification
permissionName - name of the permission Enum.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:
SBuild - build
Returns:
see above

canStopBuild

public static boolean canStopBuild(@NotNull
                                   SBuild build)
Returns true if current authority holder can stop build

Parameters:
SBuild - build
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