Search in sources :

Example 1 with ProjectPermissions

use of jetbrains.buildServer.server.graphql.model.ProjectPermissions in project teamcity-rest by JetBrains.

the class ProjectResolver method permissions.

@NotNull
public ProjectPermissions permissions(@NotNull Project source, @NotNull DataFetchingEnvironment env) {
    GraphQLContext ctx = env.getContext();
    SUser user = ctx.getUser();
    if (user == null) {
        return new ProjectPermissions(false);
    }
    SProject self = source.getRealProject();
    return new ProjectPermissions(AuthUtil.hasPermissionToManageAgentPoolsWithProject(user, self.getProjectId()));
}
Also used : SUser(jetbrains.buildServer.users.SUser) ProjectPermissions(jetbrains.buildServer.server.graphql.model.ProjectPermissions) GraphQLContext(jetbrains.buildServer.server.graphql.GraphQLContext) SProject(jetbrains.buildServer.serverSide.SProject) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

GraphQLContext (jetbrains.buildServer.server.graphql.GraphQLContext)1 ProjectPermissions (jetbrains.buildServer.server.graphql.model.ProjectPermissions)1 SProject (jetbrains.buildServer.serverSide.SProject)1 SUser (jetbrains.buildServer.users.SUser)1 NotNull (org.jetbrains.annotations.NotNull)1