Search in sources :

Example 1 with SimplePropertyKey

use of jetbrains.buildServer.users.SimplePropertyKey in project teamcity-rest by JetBrains.

the class UserRequest method putUserProperty.

@PUT
@Path("/{userLocator}/properties/{name}")
@Consumes("text/plain")
@Produces("text/plain")
@ApiOperation(value = "Update a property of the matching user.", nickname = "setUserProperty")
public String putUserProperty(@ApiParam(format = LocatorName.USER) @PathParam("userLocator") String userLocator, @PathParam("name") String name, String newValue) {
    SUser user = myUserFinder.getItem(userLocator, true);
    if (StringUtil.isEmpty(name)) {
        throw new BadRequestException("Property name cannot be empty.");
    }
    user.setUserProperty(new SimplePropertyKey(name), newValue);
    return BuildTypeUtil.getParameter(name, User.getProperties(myUserFinder.getItem(userLocator, true)), false, true, myBeanContext.getServiceLocator());
}
Also used : SimplePropertyKey(jetbrains.buildServer.users.SimplePropertyKey) SUser(jetbrains.buildServer.users.SUser) BadRequestException(jetbrains.buildServer.server.rest.errors.BadRequestException) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with SimplePropertyKey

use of jetbrains.buildServer.users.SimplePropertyKey in project teamcity-rest by JetBrains.

the class GroupRequest method removeUserProperty.

@DELETE
@Path("/{groupLocator}/properties/{name}")
@ApiOperation(value = "Remove a property of the matching user group.", nickname = "removeGroupProperty")
public void removeUserProperty(@PathParam("groupLocator") String groupLocator, @PathParam("name") String name) {
    SUserGroup group = myUserGroupFinder.getGroup(groupLocator);
    if (StringUtil.isEmpty(name)) {
        throw new BadRequestException("Property name cannot be empty.");
    }
    group.deleteGroupProperty(new SimplePropertyKey(name));
}
Also used : SimplePropertyKey(jetbrains.buildServer.users.SimplePropertyKey) BadRequestException(jetbrains.buildServer.server.rest.errors.BadRequestException) SUserGroup(jetbrains.buildServer.groups.SUserGroup) ApiOperation(io.swagger.annotations.ApiOperation)

Example 3 with SimplePropertyKey

use of jetbrains.buildServer.users.SimplePropertyKey in project teamcity-rest by JetBrains.

the class UserRequest method removeUserProperty.

@DELETE
@Path("/{userLocator}/properties/{name}")
@ApiOperation(value = "Remove a property of the matching user.", nickname = "removeUserProperty")
public void removeUserProperty(@ApiParam(format = LocatorName.USER) @PathParam("userLocator") String userLocator, @PathParam("name") String name) {
    SUser user = myUserFinder.getItem(userLocator, true);
    if (StringUtil.isEmpty(name)) {
        throw new BadRequestException("Property name cannot be empty.");
    }
    user.deleteUserProperty(new SimplePropertyKey(name));
}
Also used : SimplePropertyKey(jetbrains.buildServer.users.SimplePropertyKey) SUser(jetbrains.buildServer.users.SUser) BadRequestException(jetbrains.buildServer.server.rest.errors.BadRequestException) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)3 BadRequestException (jetbrains.buildServer.server.rest.errors.BadRequestException)3 SimplePropertyKey (jetbrains.buildServer.users.SimplePropertyKey)3 SUser (jetbrains.buildServer.users.SUser)2 SUserGroup (jetbrains.buildServer.groups.SUserGroup)1