Package com.atlassian.bamboo.security
Class BambooPermissionManagerImpl
- java.lang.Object
-
- com.atlassian.bamboo.security.BambooPermissionManagerImpl
-
- All Implemented Interfaces:
BambooPermissionManager
public class BambooPermissionManagerImpl extends Object implements BambooPermissionManager
-
-
Field Summary
Fields Modifier and Type Field Description protected org.acegisecurity.acls.MutableAclServiceaclService-
Fields inherited from interface com.atlassian.bamboo.security.BambooPermissionManager
SYSTEM_AUTHORITY
-
-
Constructor Summary
Constructors Constructor Description BambooPermissionManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanCreateDeploymentProject()booleancanCreatePlan()Checks if currently logged in user can create new plans.booleancanCreatePlanInProject(@NotNull Project project)Checks if currently logged in user can create plans in aproject.booleancanCreatePlanInProject(@NotNull String projectKey)Checks if currently logged in user can create plans in a project identified byprojectKey.booleancanCreateProject()Checks if currently logged in user can create new projects.booleancanManageAgents()Returns true if the current user has credentials to manage Bamboo Agents.booleancanManageElasticBamboo()Returns true if the current user has credentials to manage Elastic Bamboo.booleancanManageEphemeralAgents()Returns true if the current user has credentials to manage Ephemeral Agents.booleancanRunCustomBuild(@NotNull PlanKey planKey)protected booleancheckPermissionForObjectIdentity(@NotNull org.acegisecurity.acls.objectidentity.ObjectIdentity identity, @NotNull org.acegisecurity.acls.Permission permission, @NotNull org.acegisecurity.Authentication authentication)protected org.acegisecurity.acls.objectidentity.ObjectIdentitycreateObjectIdentity(@NotNull Object object)org.acegisecurity.acls.AclgetAcl(@NotNull Object object)@NotNull Collection<String>getAdminGroups()Get a list of all the groups that have global administration permission@NotNull Collection<String>getAdminUsers()Get a list of all the users that have global administration permission@NotNull StringgetDefaultUsersGroup()@NotNull Collection<String>getGroupsWithPermission(BambooPermission permission)Collection<org.acegisecurity.acls.Permission>getPermissionsForPlan(@NotNull PlanKey planKey)@NotNull Collection<String>getRestrictedAdminGroups()Get a list of all the groups that have global restricted administration permission@NotNull Collection<String>getRestrictedAdminUsers()Get a list of all the users that have global restricted administration permission@NotNull Collection<String>getUsePermissionGroups()Get a list of all the groups that have global read or create plan permission@NotNull Collection<String>getUsePermissionUsers()Get a list of all the users that have global read or create plan permission@NotNull Collection<String>getUsersWithPermission(BambooPermission permission)booleanhasGlobalPermission(@NotNull org.acegisecurity.acls.Permission permission)com.google.common.base.Predicate<Object>hasPermission(@NotNull BambooPermission permission, @Nullable org.acegisecurity.Authentication authentication)Predicate for {link #hasPermission(permission, object, authentication)}booleanhasPermission(@NotNull String username, @NotNull org.acegisecurity.acls.Permission permission, @NotNull Object object)protected booleanhasPermission(@NotNull org.acegisecurity.acls.Permission permission, @NotNull HibernateObjectIdentityImpl objectIdentity, @NotNull org.acegisecurity.Authentication authentication)booleanhasPermission(@NotNull org.acegisecurity.acls.Permission permission, @NotNull Object object, @Nullable org.acegisecurity.Authentication authentication)Checks whether a permission is granted to access object with given authentication.protected booleanhasPermission(@NotNull org.acegisecurity.acls.Permission permission, @NotNull org.acegisecurity.acls.objectidentity.ObjectIdentity objectIdentity, @NotNull org.acegisecurity.Authentication authentication)booleanhasPermissionForAuthority(@NotNull org.acegisecurity.acls.Permission permission, @NotNull Object object, @NotNull org.acegisecurity.GrantedAuthority authority)Checks whether a permission is granted to access object with given authority.booleanhasPlanPermission(@NotNull org.acegisecurity.acls.Permission permission, @NotNull ImmutablePlan plan)Verify plan accessbooleanhasPlanPermission(@NotNull org.acegisecurity.acls.Permission permission, @NotNull PlanKey planKey)Verify plan accessbooleanhasProjectEditPermission(@Nullable Project project)booleanhasProjectPermission(@NotNull org.acegisecurity.acls.Permission permission, @NotNull Project project)Checks if currently logged in user has apermissionfor aproject.booleanhasProjectPermission(@NotNull org.acegisecurity.acls.Permission permission, @NotNull String projectKey)Checks if currently logged in user has apermissionfor a project identified byprojectKey.booleanisAdmin(String username)Returns true if the user is an admin, false if notbooleanisAllowedToSetGlobalPermission(@NotNull org.acegisecurity.acls.Permission permission)Returns true if user is allowed to set specific global permissionbooleanisEnableSignup()protected booleanisPermissionSuppressedByTokenAuthorisation(@NotNull org.acegisecurity.acls.Permission permission)booleanisSystemAdmin(String username)Returns true if the user is a sysadmin, false if notprotected org.acegisecurity.acls.AclreadAclById(org.acegisecurity.acls.objectidentity.ObjectIdentity identity)voidsetAclService(org.acegisecurity.acls.MutableAclService aclService)voidsetAdministrationConfigurationAccessor(AdministrationConfigurationAccessor administrationConfigurationAccessor)voidsetCachedPlanManager(CachedPlanManager cachedPlanManager)voidsetObjectIdentityRetrievalStrategy(org.acegisecurity.acls.objectidentity.ObjectIdentityRetrievalStrategy objectIdentityRetrievalStrategy)voidsetOverrideAuthorities(org.acegisecurity.GrantedAuthority[] overrideAuthorities)voidsetProjectManager(ProjectManager projectManager)voidsetScopesRequestCacheDelegate(ScopesRequestCacheDelegate scopesRequestCacheDelegate)voidsetSidRetrievalStrategy(org.acegisecurity.acls.sid.SidRetrievalStrategy sidRetrievalStrategy)
-
-
-
Method Detail
-
hasPermission
public boolean hasPermission(@NotNull @NotNull org.acegisecurity.acls.Permission permission, @NotNull @NotNull Object object, @Nullable @Nullable org.acegisecurity.Authentication authentication)Description copied from interface:BambooPermissionManagerChecks whether a permission is granted to access object with given authentication.- Specified by:
hasPermissionin interfaceBambooPermissionManager- Parameters:
permission- the permission to check forobject- the domain object on which the permission check will be madeauthentication- the authentication/principal whose secure identities will be checked for the permission- Returns:
-
checkPermissionForObjectIdentity
protected boolean checkPermissionForObjectIdentity(@NotNull @NotNull org.acegisecurity.acls.objectidentity.ObjectIdentity identity, @NotNull @NotNull org.acegisecurity.acls.Permission permission, @NotNull @NotNull org.acegisecurity.Authentication authentication)
-
isPermissionSuppressedByTokenAuthorisation
protected boolean isPermissionSuppressedByTokenAuthorisation(@NotNull @NotNull org.acegisecurity.acls.Permission permission)
-
hasPermission
public com.google.common.base.Predicate<Object> hasPermission(@NotNull @NotNull BambooPermission permission, @Nullable @Nullable org.acegisecurity.Authentication authentication)
Description copied from interface:BambooPermissionManagerPredicate for {link #hasPermission(permission, object, authentication)}- Specified by:
hasPermissionin interfaceBambooPermissionManager- Parameters:
permission- the permission to check forauthentication- the authentication/principal whose secure identities will be checked for the permission- Returns:
-
hasPermissionForAuthority
public boolean hasPermissionForAuthority(@NotNull @NotNull org.acegisecurity.acls.Permission permission, @NotNull @NotNull Object object, @NotNull @NotNull org.acegisecurity.GrantedAuthority authority)Description copied from interface:BambooPermissionManagerChecks whether a permission is granted to access object with given authority.- Specified by:
hasPermissionForAuthorityin interfaceBambooPermissionManager- Parameters:
permission- the permission to check forobject- the domain object on which the permission check will be madeauthority- the authority whose secure identities will be checked for the permission- Returns:
-
getAcl
public org.acegisecurity.acls.Acl getAcl(@NotNull @NotNull Object object)- Specified by:
getAclin interfaceBambooPermissionManager
-
readAclById
protected org.acegisecurity.acls.Acl readAclById(org.acegisecurity.acls.objectidentity.ObjectIdentity identity)
-
hasPermission
public boolean hasPermission(@NotNull @NotNull String username, @NotNull @NotNull org.acegisecurity.acls.Permission permission, @NotNull @NotNull Object object)- Specified by:
hasPermissionin interfaceBambooPermissionManager
-
hasPlanPermission
public boolean hasPlanPermission(@NotNull @NotNull org.acegisecurity.acls.Permission permission, @NotNull @NotNull PlanKey planKey)Description copied from interface:BambooPermissionManagerVerify plan access- Specified by:
hasPlanPermissionin interfaceBambooPermissionManager- Parameters:
permission- permission to checkplanKey- key of the plan- Returns:
- true iff permission is granted
-
hasPlanPermission
public boolean hasPlanPermission(@NotNull @NotNull org.acegisecurity.acls.Permission permission, @NotNull @NotNull ImmutablePlan plan)Description copied from interface:BambooPermissionManagerVerify plan access- Specified by:
hasPlanPermissionin interfaceBambooPermissionManager- Parameters:
permission- permission to checkplan- plan- Returns:
- true iff permission is granted
-
hasProjectPermission
public boolean hasProjectPermission(@NotNull @NotNull org.acegisecurity.acls.Permission permission, @NotNull @NotNull String projectKey)Description copied from interface:BambooPermissionManagerChecks if currently logged in user has apermissionfor a project identified byprojectKey.- Specified by:
hasProjectPermissionin interfaceBambooPermissionManager- Parameters:
permission- permission to checkprojectKey- key of the project to check- Returns:
- true if project with the given key exists and current user has the permission to it
-
hasProjectPermission
public boolean hasProjectPermission(@NotNull @NotNull org.acegisecurity.acls.Permission permission, @NotNull @NotNull Project project)Description copied from interface:BambooPermissionManagerChecks if currently logged in user has apermissionfor aproject.- Specified by:
hasProjectPermissionin interfaceBambooPermissionManager- Parameters:
permission- permission to checkproject- project to check- Returns:
- true if current user has the permission to the project
-
canCreatePlanInProject
public boolean canCreatePlanInProject(@NotNull @NotNull String projectKey)Description copied from interface:BambooPermissionManagerChecks if currently logged in user can create plans in a project identified byprojectKey.- Specified by:
canCreatePlanInProjectin interfaceBambooPermissionManager- Parameters:
projectKey- key of the project to check- Returns:
- true if project with the given key exists and current user can create plans in it
-
canCreatePlanInProject
public boolean canCreatePlanInProject(@NotNull @NotNull Project project)Description copied from interface:BambooPermissionManagerChecks if currently logged in user can create plans in aproject.- Specified by:
canCreatePlanInProjectin interfaceBambooPermissionManager- Parameters:
project- project to check- Returns:
- true if current user can create plans in the project
-
canCreateProject
public boolean canCreateProject()
Description copied from interface:BambooPermissionManagerChecks if currently logged in user can create new projects.- Specified by:
canCreateProjectin interfaceBambooPermissionManager- Returns:
- true if current user can create projects
-
canCreatePlan
public boolean canCreatePlan()
Description copied from interface:BambooPermissionManagerChecks if currently logged in user can create new plans.This method might be expensive to compute as it may need to check permissions on all projects for this Bamboo instance.
- Specified by:
canCreatePlanin interfaceBambooPermissionManager- Returns:
- true if current user can create plans
-
canCreateDeploymentProject
public boolean canCreateDeploymentProject()
- Specified by:
canCreateDeploymentProjectin interfaceBambooPermissionManager
-
hasGlobalPermission
public boolean hasGlobalPermission(@NotNull @NotNull org.acegisecurity.acls.Permission permission)- Specified by:
hasGlobalPermissionin interfaceBambooPermissionManager
-
getPermissionsForPlan
public Collection<org.acegisecurity.acls.Permission> getPermissionsForPlan(@NotNull @NotNull PlanKey planKey)
- Specified by:
getPermissionsForPlanin interfaceBambooPermissionManager
-
hasProjectEditPermission
public boolean hasProjectEditPermission(@Nullable @Nullable Project project)- Specified by:
hasProjectEditPermissionin interfaceBambooPermissionManager
-
isEnableSignup
public boolean isEnableSignup()
- Specified by:
isEnableSignupin interfaceBambooPermissionManager
-
getAdminGroups
@NotNull public @NotNull Collection<String> getAdminGroups()
Description copied from interface:BambooPermissionManagerGet a list of all the groups that have global administration permission- Specified by:
getAdminGroupsin interfaceBambooPermissionManager- Returns:
- A list of all the groups that have global administration permission
-
getRestrictedAdminGroups
@NotNull public @NotNull Collection<String> getRestrictedAdminGroups()
Description copied from interface:BambooPermissionManagerGet a list of all the groups that have global restricted administration permission- Specified by:
getRestrictedAdminGroupsin interfaceBambooPermissionManager- Returns:
- A list of all the groups that have global restricted administration permission
-
getUsePermissionGroups
@NotNull public @NotNull Collection<String> getUsePermissionGroups()
Description copied from interface:BambooPermissionManagerGet a list of all the groups that have global read or create plan permission- Specified by:
getUsePermissionGroupsin interfaceBambooPermissionManager- Returns:
- A list of all the groups that have global read or create plan permission
-
getDefaultUsersGroup
@NotNull public @NotNull String getDefaultUsersGroup()
- Specified by:
getDefaultUsersGroupin interfaceBambooPermissionManager- Returns:
- the name of the default group that users will be added to when they are created
-
getGroupsWithPermission
@NotNull public @NotNull Collection<String> getGroupsWithPermission(BambooPermission permission)
-
getAdminUsers
@NotNull public @NotNull Collection<String> getAdminUsers()
Description copied from interface:BambooPermissionManagerGet a list of all the users that have global administration permission- Specified by:
getAdminUsersin interfaceBambooPermissionManager- Returns:
- A list of all the users that have global administration permission
-
getRestrictedAdminUsers
@NotNull public @NotNull Collection<String> getRestrictedAdminUsers()
Description copied from interface:BambooPermissionManagerGet a list of all the users that have global restricted administration permission- Specified by:
getRestrictedAdminUsersin interfaceBambooPermissionManager- Returns:
- A list of all the users that have global restricted administration permission
-
getUsePermissionUsers
@NotNull public @NotNull Collection<String> getUsePermissionUsers()
Description copied from interface:BambooPermissionManagerGet a list of all the users that have global read or create plan permission- Specified by:
getUsePermissionUsersin interfaceBambooPermissionManager- Returns:
- A list of all the users that have global read or create plan permission
-
getUsersWithPermission
@NotNull public @NotNull Collection<String> getUsersWithPermission(BambooPermission permission)
-
isAdmin
public boolean isAdmin(String username)
Description copied from interface:BambooPermissionManagerReturns true if the user is an admin, false if not- Specified by:
isAdminin interfaceBambooPermissionManager- Parameters:
username- the user- Returns:
- true if the user is an admin, false if not
-
isSystemAdmin
public boolean isSystemAdmin(String username)
Description copied from interface:BambooPermissionManagerReturns true if the user is a sysadmin, false if not- Specified by:
isSystemAdminin interfaceBambooPermissionManager- Parameters:
username- the user- Returns:
- true if the user is a sysadmin, false if not
-
isAllowedToSetGlobalPermission
public boolean isAllowedToSetGlobalPermission(@NotNull @NotNull org.acegisecurity.acls.Permission permission)Description copied from interface:BambooPermissionManagerReturns true if user is allowed to set specific global permission- Specified by:
isAllowedToSetGlobalPermissionin interfaceBambooPermissionManager- Parameters:
permission- permission to check- Returns:
-
canManageElasticBamboo
public boolean canManageElasticBamboo()
Description copied from interface:BambooPermissionManagerReturns true if the current user has credentials to manage Elastic Bamboo. Note that this permission is only required for Elastic Bamboo configuration (including operations like viewing EC2 instances, their statuses, logs etc.). Normal usage of Bamboo with EC2 configured (e.g. running builds on elastic agents) does not require such credentials.- Specified by:
canManageElasticBambooin interfaceBambooPermissionManager- Returns:
- true, if current user has permission to configure Elastic Bamboo
-
canManageEphemeralAgents
public boolean canManageEphemeralAgents()
Description copied from interface:BambooPermissionManagerReturns true if the current user has credentials to manage Ephemeral Agents. Note that this permission is only required for Ephemeral Agents configuration (including operations like viewing templates). Normal usage of Bamboo with Ephemeral Agents configured (e.g. running builds) does not require such credentials.- Specified by:
canManageEphemeralAgentsin interfaceBambooPermissionManager- Returns:
- true, if current user has permission to configure Ephemeral Agents
-
canManageAgents
public boolean canManageAgents()
Description copied from interface:BambooPermissionManagerReturns true if the current user has credentials to manage Bamboo Agents.- Specified by:
canManageAgentsin interfaceBambooPermissionManager- Returns:
- true if the current user has permission to manage agents, false otherwise
-
canRunCustomBuild
public boolean canRunCustomBuild(@NotNull @NotNull PlanKey planKey)- Specified by:
canRunCustomBuildin interfaceBambooPermissionManager- Parameters:
planKey- key of the plan in question- Returns:
- true if the current user is allowed to run custom build of specified plan
-
hasPermission
protected boolean hasPermission(@NotNull @NotNull org.acegisecurity.acls.Permission permission, @NotNull @NotNull HibernateObjectIdentityImpl objectIdentity, @NotNull @NotNull org.acegisecurity.Authentication authentication)
-
hasPermission
protected boolean hasPermission(@NotNull @NotNull org.acegisecurity.acls.Permission permission, @NotNull @NotNull org.acegisecurity.acls.objectidentity.ObjectIdentity objectIdentity, @NotNull @NotNull org.acegisecurity.Authentication authentication)
-
createObjectIdentity
protected org.acegisecurity.acls.objectidentity.ObjectIdentity createObjectIdentity(@NotNull @NotNull Object object)
-
setAdministrationConfigurationAccessor
public void setAdministrationConfigurationAccessor(AdministrationConfigurationAccessor administrationConfigurationAccessor)
-
setAclService
public void setAclService(org.acegisecurity.acls.MutableAclService aclService)
-
setSidRetrievalStrategy
public void setSidRetrievalStrategy(org.acegisecurity.acls.sid.SidRetrievalStrategy sidRetrievalStrategy)
-
setCachedPlanManager
public void setCachedPlanManager(CachedPlanManager cachedPlanManager)
-
setProjectManager
public void setProjectManager(ProjectManager projectManager)
-
setOverrideAuthorities
public void setOverrideAuthorities(org.acegisecurity.GrantedAuthority[] overrideAuthorities)
-
setObjectIdentityRetrievalStrategy
public void setObjectIdentityRetrievalStrategy(org.acegisecurity.acls.objectidentity.ObjectIdentityRetrievalStrategy objectIdentityRetrievalStrategy)
-
setScopesRequestCacheDelegate
public void setScopesRequestCacheDelegate(ScopesRequestCacheDelegate scopesRequestCacheDelegate)
-
-