Enable user

ENDPOINT /api/v0-user/enable/[userid] (POST only)

When generating URLs, [userid] is the id of a user SecurityPrincipal

A parameter of status with value of either block or active should be passed with requests to the endpoint. Passing block will disable the user, set isActive to false, and block the user from logging in. Blocking an already blocked user will do nothing. Passing a value of active will re-enable a blocked user, allow them to log in again, and set isActive to true. Setting an already active user as active will have no effect

Returns

This request can respond with following kinds, in addition to the generic kinds (see Introduction):

Kind Meaning
haplo:api-v0:user:enable The request was successful and the blocked/enabled user’s details have been returned
haplo:api-v0:user:enable-failed The value provided in the status parameter was not valid. Returns with HTTP status 400
haplo:api-v0:user:no-such-user No user could be found with the requested id. Returns with HTTP status 400

Along with the standard success and kind fields (see Introduction for explanation), the response has the following structure:

  • user
    • id
    • nameFirst
    • nameLast
    • name
    • code
    • email
    • ref
    • isGroup
    • isActive
    • isSuperUser
    • isServiceUser
    • isAnonymous
    • localeId
    • directGroupMembership

Apart from directGroupMembership, all the fields correspond directly to the equivalent field on the SecurityPrincipal. directGroupMembership is the equivalent of directGroupIds, but returns an array of group API codes instead of group IDs.

Example response

{
    "success": true,
    "kind": "haplo:api-v0:user:enable",
    "user": {
        "id":130,
        "nameFirst":"First",
        "nameLast":"Last",
        "name":"First Last",
        "code":null,
        "email":"first.last@example.com",
        "ref":null,
        "isGroup":false,
        "isActive":false,
        "isSuperUser":false,
        "isServiceUser":false,
        "isAnonymous":false,
        "localeId":"en",
        "directGroupMembership":[
            "haplo:group:example", 
            "group:123"
        ]
    }
}