HTTP API_user - gd-99/symbiogd GitHub Wiki
The module user
manages registered users.
Actions
canRegister
Check if the user can register.
Returned data: an object containing these values:
- boolean register: true if the user is able to register
- boolean autoEnable: true if the user will be able to use his account right after registration (an admin verification isn't required)
canResetPassword
Check if the user is able to reset his password, if lost.
Returned data: an object containing these values:
- boolean enabled: true if the user is able to reset his password
- number delay: delay between two attempts
- string emailFrom: the e-mail sender adress
getList
Get a list of all users.
Permission required: user.read
Returned data: an object containing user ids associated with their data.
getAttributes
Get data about a specific user, providing his id.
Permission required: user.read
Arguments:
- number
userId
: the user id
Returns the user's data.
getAttributesByUsername
Get data about a specific user, providing his username.
Permission required: user.read
Arguments:
- string
username
: the username
Returns the user's data.
getAttribute
Get a user's attribute.
This action is deprecated.
getLogged
Get data about the logged in user.
Returns the logged in user's data.
getAuthorizations
Get a user's permissions.
Permission required: user.read
Arguments:
- number
userId
: the user id
Returns a list of permissions.
getStats
Get global stats about users.
Permission required: user.read
Returned data: an object containing these values:
- number nbr_users: the number of registered users
connect
Login a user.
Arguments:
- string
username
: the username - string
password
: the password
Returns the logged in user's data if the username and the password are correct.
Errors:
- 401: bad username or password. The request is paused during a few seconds to avoid bruteforce attacks.
- 403: user is disabled
disconnect
Logout the user.
setAttribute
Set a user's attribute.
This action is deprecated.
setMultipleAttributes
Update a user's attributes. To change the user's password, please use setPassword
.
This action will be renamed to
setAttributes
in a future release and will be deprecated.
Permission required: user.write
Arguments:
- object
data
: the new user's data, excluding the user id and the password. - number
userId
: the user id
Errors:
- 400: bad request, e.g. updating an incorrect attribute
setPassword
Update the logged in user's password. Only the logged in user password can be changed (admins cannot change other users password).
Permission required: user.self.write
Arguments:
- string
currentPassword
: the current password. - string
newPassword
: the new password.
Errors: same as connect
.
setAuthorizations
Set a user's permissions. All existing permissions will be removed.
Permission required: user.manage
Arguments:
- array
authsList
: a list of permissions. - number
userId
: the user id.
setEnabled
Enable/disable a user.
Permission required: user.manage
Arguments:
- boolean
value
: true to enable the user, false to disable. - number
userId
: the user id.
remove
Remove a user.
Permission required: user.edit
Arguments:
- number
userId
: the user id.
create
Creates a new user.
Permission required: user.manage
Arguments:
- Object
data
: the new user's data, excluding the user id. - Array
authsList
: a list of permissions to grant to the new user.
Returns the new user's data.
register
Register a new user. The difference between this action and create
is that this action doesn't require any permission.
Arguments:
- Object
data
: the new user's data, excludingid
anddisabled
. - Object
captchaData
: an object containing captcha data.
Returns the new user's data.
sendResetPasswordRequest
getTokenByEmail
resetPassword
Data models
user
Public attributes:
id
: the user idusername
: the usernamerealname
: the user's real nameemail
: the user's emaildisabled
: true if the user is disabled
Other attributes:
password
(write-only): the user's password