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);
}
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);
}
Aggregations