Users
class Users extends DolibarrApi (View source)
API class for users
Properties
| protected DoliDB | $db | from DolibarrApi | |
| Restler | $r | from DolibarrApi | |
| static string[] | $FIELDS | ||
| User | $useraccount |
Methods
Constructor
Check and convert a string depending on its type/name.
Filter properties that will be returned on object
Clean sensible object datas
Check access by user to a given resource
Return if a $sqlfilters parameter is valid Function no more used. Kept for backward compatibility with old APIs of modules
Function to forge a SQL criteria from a Generic filter string.
List users
Get a user
Get a user by login
Get a user by email
Get more properties of the current user (so user of API token).
Create a user
Update a user
Update a user password
List the groups of a user
Add a user to a group
Create user group
Update user group
Remove user from group (only admin)
List groups of the current user (so user of API token)
Get properties of a user group
Delete a user
Delete a usergroup
Get notifications for a user
Create a notification for a user
Create a notification for a user using action trigger code
Delete a notification attached to a user
Update a notification for a user
Details
__construct()
Constructor
protected string|array<string, mixed>
_checkValForAPI(string $field, string|string[] $value, object $object)
Check and convert a string depending on its type/name.
protected object
_filterObjectProperties(object $object, string $properties)
Filter properties that will be returned on object
protected object
_cleanObjectDatas(object $object)
Clean sensible object datas
static protected bool
_checkAccessToResource(string $resource, int $resource_id = 0, string $dbtablename = '', string $feature2 = '', string $dbt_keyfield = 'fk_soc', string $dbt_select = 'rowid')
Check access by user to a given resource
protected bool|string
_checkFilters(string $sqlfilters, string $error = '')
Return if a $sqlfilters parameter is valid Function no more used. Kept for backward compatibility with old APIs of modules
static protected string
_forge_criteria_callback(string[] $matches)
Function to forge a SQL criteria from a Generic filter string.
Function no more used. Kept for backward compatibility with old APIs of modules
array
index(string $sortfield = "t.rowid", string $sortorder = 'ASC', int $limit = 100, int $page = 0, string $user_ids = '0', int $category = 0, string $sqlfilters = '', string $properties = '')
List users
Get a list of Users
array|mixed
get(int $id, int $includepermissions = 0)
Get a user
array|mixed
getByLogin(string $login, int $includepermissions = 0)
Get a user by login
array|mixed
getByEmail(string $email, int $includepermissions = 0)
Get a user by email
array|mixed
getInfo(int $includepermissions = 0)
Get more properties of the current user (so user of API token).
This route could also ave been named "/users/me".
int
post(array $request_data = null)
Create a user
object
put(int $id, array $request_data = null)
Update a user
int
setPassword(int $id, bool $send_password = false)
Update a user password
array
getGroups(int $id)
List the groups of a user
int
setGroup(int $id, int $group, int $entity = 1)
Add a user to a group
int
postGroups(array $request_data = null)
Create user group
object
putGroups(int $group, array $request_data = null)
Update user group
array{success: bool, message: string}
removeUserFromGroup(int $id, int $group)
Remove user from group (only admin)
array
listGroups(string $sortfield = "t.rowid", string $sortorder = 'ASC', int $limit = 100, int $page = 0, string $group_ids = '0', string $sqlfilters = '', string $properties = '')
List groups of the current user (so user of API token)
Return an array with a list of Groups
object
infoGroups(int $group, int $load_members = 0)
Get properties of a user group
Return an array with group information
array
delete(int $id)
Delete a user
array
deleteGroups(int $group)
Delete a usergroup
array
getUserNotification(int $id)
Get notifications for a user
array|mixed
createUserNotification(int $id, array $request_data = null)
Create a notification for a user
array|mixed
createUserNotificationByCode(int $id, string $code, array $request_data = null)
Create a notification for a user using action trigger code
int
deleteUserNotification(int $id, int $notification_id)
Delete a notification attached to a user
array|mixed
updateUserNotification(int $id, int $notification_id, array $request_data = null)
Update a notification for a user