Esta es una traducción de la página de documentación original en español. Ayúdanos a mejorarla.

user.update

Description

object user.update(object/array users)

This method allows to update existing users.

This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

The strength of user password is validated according the password policy rules defined by Authentication API. See Authentication API for more information.

Parameters

(object/array) User properties to be updated.

The userid property must be defined for each user, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged.

Additionally to the standard user properties, the method accepts the following parameters.

Parameter Type Description
passwd string User's password.

Can be empty string if user belongs to or is moved only to groups that have LDAP access.
usrgrps array User groups to replace existing user groups.

The user groups must have the usrgrpid property defined.
medias array User media to replace existing media.

Valores de retorno

(objeto) Devuelve un objeto que contiene los ID de los usuarios actualizados bajo la propiedad userids.

Ejemplos

Renaming a user

Rename a user to John Doe.

Request:

{
           "jsonrpc": "2.0",
           "method": "user.update",
           "params": {
               "userid": "1",
               "name": "John",
               "surname": "Doe"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "userids": [
                   "1"
               ]
           },
           "id": 1
       }

Cambiar rol de usuario

Cambiar el rol de un usuario.

Solicitud:

{
           "jsonrpc": "2.0",
           "method": "user.update",
           "params": {
               "userid": "12",
               "roleid": "6"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Respuesta:

{
           "jsonrpc": "2.0",
           "result": {
               "userids": [
                   "12"
               ]
           },
           "id": 1
       }

See also

Fuente

CUser::update() en ui/include/classes/api/services/CUser.php.