use of jetbrains.buildServer.server.graphql.model.agentPool.AgentPoolPermissions in project teamcity-rest by JetBrains.
the class AbstractAgentPoolResolver method permissions.
@NotNull
public AgentPoolPermissions permissions(@NotNull AbstractAgentPool pool, @NotNull DataFetchingEnvironment env) {
jetbrains.buildServer.serverSide.agentPools.AgentPool realPool = pool.getRealPool();
int poolId = realPool.getAgentPoolId();
AuthorityHolder authHolder = mySecurityContext.getAuthorityHolder();
boolean canManagePool = !realPool.isProjectPool() && realPool.getAgentPoolId() != AgentPool.DEFAULT_POOL_ID && authHolder.isPermissionGrantedGlobally(Permission.MANAGE_AGENT_POOLS);
BooleanSupplier canAuthorizeUnauthorizeAgent = () -> AuthUtil.hasPermissionToAuthorizeAgentsInPool(authHolder, realPool);
BooleanSupplier canEnableDisableAgent = () -> AuthUtil.hasPermissionToEnableAgentsInPool(authHolder, realPool);
BooleanSupplier canManageProjectPoolAssociations = () -> myPoolActionsAccessChecker.canManageProjectsInPool(poolId);
BooleanSupplier canManageAgents = () -> myPoolActionsAccessChecker.canManageAgentsInPool(realPool);
return new AgentPoolPermissions(canAuthorizeUnauthorizeAgent, canManageProjectPoolAssociations, canEnableDisableAgent, canManageAgents, canManagePool);
}
Aggregations