Search in sources :

Example 1 with RoleAssignment

use of jetbrains.buildServer.server.rest.model.user.RoleAssignment in project teamcity-rest by JetBrains.

the class GroupRequest method addRole.

@POST
@Path("/{groupLocator}/roles")
@Consumes({ "application/xml", "application/json" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Add a role to the matching user group.", nickname = "addRoleToGroup")
public RoleAssignment addRole(@PathParam("groupLocator") String groupLocator, RoleAssignment roleAssignment) {
    SUserGroup group = myUserGroupFinder.getGroup(groupLocator);
    group.addRole(RoleAssignment.getScope(roleAssignment.scope, myBeanContext.getServiceLocator()), RoleAssignment.getRoleById(roleAssignment.roleId, myBeanContext.getServiceLocator()));
    return new RoleAssignment(DataProvider.getGroupRoleEntry(group, roleAssignment.roleId, roleAssignment.scope, myBeanContext), group, myBeanContext);
}
Also used : RoleAssignment(jetbrains.buildServer.server.rest.model.user.RoleAssignment) SUserGroup(jetbrains.buildServer.groups.SUserGroup) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with RoleAssignment

use of jetbrains.buildServer.server.rest.model.user.RoleAssignment in project teamcity-rest by JetBrains.

the class GroupRequest method addRoleSimple.

@POST
@Path("/{groupLocator}/roles/{roleId}/{scope}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Add a role with the specific scope to the matching user group.", nickname = "addRoleAtScopeToGroup")
public RoleAssignment addRoleSimple(@PathParam("groupLocator") String groupLocator, @PathParam("roleId") String roleId, @PathParam("scope") String scopeValue) {
    SUserGroup group = myUserGroupFinder.getGroup(groupLocator);
    group.addRole(RoleAssignment.getScope(scopeValue, myBeanContext.getServiceLocator()), RoleAssignment.getRoleById(roleId, myBeanContext.getServiceLocator()));
    return new RoleAssignment(DataProvider.getGroupRoleEntry(group, roleId, scopeValue, myBeanContext), group, myBeanContext);
}
Also used : RoleAssignment(jetbrains.buildServer.server.rest.model.user.RoleAssignment) SUserGroup(jetbrains.buildServer.groups.SUserGroup) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)2 SUserGroup (jetbrains.buildServer.groups.SUserGroup)2 RoleAssignment (jetbrains.buildServer.server.rest.model.user.RoleAssignment)2