|
dolibarr 24.0.0-beta
|


Public Member Functions | |
| __construct () | |
| Constructor. | |
| index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $user_ids='0', $category=0, $sqlfilters='', $properties='') | |
| List users. | |
| get ($id, $includepermissions=0) | |
| Get a user. | |
| getByLogin ($login, $includepermissions=0) | |
| Get a user by login. | |
| getByEmail ($email, $includepermissions=0) | |
| Get a user by email. | |
| getInfo ($includepermissions=0) | |
| Get more properties of the current user (so user of API token). | |
| post ($request_data=null) | |
| Create a user. | |
| put ($id, $request_data=null) | |
| Update a user. | |
| setPassword ($id, $send_password=false) | |
| Update a user password. | |
| getGroups ($id) | |
| List the groups of a user. | |
| setGroup ($id, $group, $entity=1) | |
| Add a user to a group. | |
| postGroups ($request_data=null) | |
| Create user group. | |
| putGroups ($group, $request_data=null) | |
| Update user group. | |
| removeUserFromGroup ($id, $group) | |
| Remove user from group (only admin) | |
| listGroups ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $group_ids='0', $sqlfilters='', $properties='') | |
| List groups of the current user (so user of API token) | |
| infoGroups ($group, $load_members=0, $includepermissions=0) | |
| Get properties of a user group. | |
| delete ($id) | |
| Delete a user. | |
| deleteGroups ($group) | |
| Delete a usergroup. | |
| getUserNotification ($id) | |
| Get notifications for a user. | |
| createUserNotification ($id, $request_data=null) | |
| Create a notification for a user. | |
| createUserNotificationByCode ($id, $code, $request_data=null) | |
| Create a notification for a user using action trigger code. | |
| deleteUserNotification ($id, $notification_id) | |
| Delete a notification attached to a user. | |
| updateUserNotification ($id, $notification_id, $request_data=null) | |
| Update a notification for a user. | |
Public Member Functions inherited from DolibarrApi | |
| __construct ($db, $cachedir='', $refreshCache=false) | |
| Constructor. | |
Protected Member Functions | |
| _cleanObjectDatas ($object) | |
| Clean sensible object datas @phpstan-template T. | |
Protected Member Functions inherited from DolibarrApi | |
| _checkValForAPI ($field, $value, $object) | |
| Check and convert a string depending on its type/name. | |
| _checkValExtrafieldsForAPI ($field, $value, $object) | |
| Check and convert a string depending on its type/name. | |
| _filterObjectProperties ($object, $properties) | |
| Filter properties that will be returned on object. | |
| _checkFilters ($sqlfilters, &$error='') | |
| Return if a $sqlfilters parameter is valid Function no more used. | |
Private Member Functions | |
| _cleanUserGroup ($object) | |
| Clean sensible usergroup object datas. | |
| _cleanUserGroupListDatas ($objectList) | |
| Clean sensible user group list datas. | |
| _validate ($data) | |
| Validate fields before create or update object. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from DolibarrApi | |
| static | _checkAccessToResource ($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
| Check access by user to a given resource. | |
| static | _forge_criteria_callback ($matches) |
| Function to forge a SQL criteria from a Generic filter string. | |
Definition at line 39 of file api_users.class.php.
|
protected |
Clean sensible object datas @phpstan-template T.
| Object | $object | Object to clean |
Reimplemented from DolibarrApi.
Definition at line 1289 of file api_users.class.php.
References $object, and isModEnabled().
Referenced by createUserNotification(), createUserNotificationByCode(), get(), getByEmail(), getByLogin(), getGroups(), getInfo(), index(), infoGroups(), listGroups(), and updateUserNotification().
|
private |
Clean sensible usergroup object datas.
| Object | $object | Object to clean |
Definition at line 1347 of file api_users.class.php.
References $object.
Referenced by infoGroups().
|
private |
Clean sensible user group list datas.
| array<UserGroup> | $objectList Array of object to clean |
Definition at line 1448 of file api_users.class.php.
References $object.
Referenced by getInfo().
|
private |
Validate fields before create or update object.
| ?array<string,mixed> | $data Data to validate |
| RestException |
Definition at line 1496 of file api_users.class.php.
| Users::createUserNotification | ( | $id, | |
| $request_data = null ) |
Create a notification for a user.
| int | $id | ID of the user |
| array | $request_data | Request data @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data |
@url POST {id}/notifications
| RestException |
Definition at line 1086 of file api_users.class.php.
References $id, DolibarrApi\_checkValForAPI(), and _cleanObjectDatas().
| Users::createUserNotificationByCode | ( | $id, | |
| $code, | |||
| $request_data = null ) |
Create a notification for a user using action trigger code.
| int | $id | ID of the user |
| string | $code | Action Trigger code |
| array | $request_data | Request data @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data |
@url POST {id}/notificationsbycode/{code}
| RestException |
Definition at line 1147 of file api_users.class.php.
References $id, DolibarrApi\_checkValForAPI(), and _cleanObjectDatas().
| Users::delete | ( | $id | ) |
Delete a user.
| int | $id | Account ID |
| RestException | 403 Not allowed |
| RestException | 404 User not found |
Definition at line 926 of file api_users.class.php.
References $id, and DolibarrApi\_checkAccessToResource().
| Users::deleteGroups | ( | $group | ) |
Delete a usergroup.
| int | $group | usergroup ID |
@url DELETE /groups/{group}
| RestException | 403 Not allowed |
| RestException | 404 User not found |
Definition at line 968 of file api_users.class.php.
| Users::deleteUserNotification | ( | $id, | |
| $notification_id ) |
Delete a notification attached to a user.
| int | $id | ID of the user |
| int | $notification_id | ID of UserNotification |
@url DELETE {id}/notifications/{notification_id}
| RestException |
Definition at line 1215 of file api_users.class.php.
References $id.
| Users::get | ( | $id, | |
| $includepermissions = 0 ) |
Get a user.
| int | $id | ID of user |
| int | $includepermissions | Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) |
| RestException | 400 Bad request |
| RestException | 401 Insufficient rights |
| RestException | 404 User or group not found |
Definition at line 168 of file api_users.class.php.
References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().
| Users::getByEmail | ( | $email, | |
| $includepermissions = 0 ) |
Get a user by email.
| string | Email of user | |
| int | $includepermissions | Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) |
@url GET email/{email}
| RestException | 400 Bad request |
| RestException | 401 Insufficient rights |
| RestException | 404 User or group not found |
Definition at line 258 of file api_users.class.php.
References DolibarrApi\_checkAccessToResource(), _cleanObjectDatas(), and email.
| Users::getByLogin | ( | $login, | |
| $includepermissions = 0 ) |
Get a user by login.
| string | $login | Login of user |
| int | $includepermissions | Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) |
@url GET login/{login}
| RestException | 400 Bad request |
| RestException | 401 Insufficient rights |
| RestException | 404 User or group not found |
Definition at line 215 of file api_users.class.php.
References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().
| Users::getGroups | ( | $id | ) |
List the groups of a user.
| int | $id | Id of user |
| RestException | 400 Bad request |
| RestException | 403 Not allowed |
| RestException | 404 Not found |
@url GET {id}/groups
Definition at line 574 of file api_users.class.php.
References $id, and _cleanObjectDatas().
| Users::getInfo | ( | $includepermissions = 0 | ) |
Get more properties of the current user (so user of API token).
This route could also ave been named "/users/me".
@url GET /info
| int | $includepermissions | Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) |
| RestException | 401 Insufficient rights |
| RestException | 404 User or group not found |
Definition at line 299 of file api_users.class.php.
References DolibarrApi\_checkAccessToResource(), _cleanObjectDatas(), and _cleanUserGroupListDatas().
| Users::getUserNotification | ( | $id | ) |
Get notifications for a user.
| int | $id | ID of the user |
@url GET {id}/notifications
| RestException | 400 Bad Request |
| RestException | 403 Access denied |
| RestException | 404 Not found |
We select all the records that match the socid
Definition at line 1010 of file api_users.class.php.
References $id, $object, and DolibarrApi\_checkAccessToResource().
| Users::index | ( | $sortfield = "t.rowid", | |
| $sortorder = 'ASC', | |||
| $limit = 100, | |||
| $page = 0, | |||
| $user_ids = '0', | |||
| $category = 0, | |||
| $sqlfilters = '', | |||
| $properties = '' ) |
List users.
Get a list of Users
| string | $sortfield | Sort field |
| string | $sortorder | Sort order |
| int | $limit | Limit for list |
| int | $page | Page number |
| string | $user_ids | User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} |
| int | $category | Use this param to filter list by category |
| string | $sqlfilters | Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:>:'20160101')" |
| string | $properties | Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names |
| RestException |
Definition at line 86 of file api_users.class.php.
References _cleanObjectDatas(), and DolibarrApi\_filterObjectProperties().
| Users::infoGroups | ( | $group, | |
| $load_members = 0, | |||
| $includepermissions = 0 ) |
Get properties of a user group.
Return an array with group information
@url GET /groups/{group}
| int | $group | ID of group |
| int | $load_members | Load members list or not {@min 0} {@max 1} |
| int | $includepermissions | Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) |
| RestException | 400 Bad Request |
| RestException | 403 Not allowed |
| RestException | 404 User not found |
Definition at line 882 of file api_users.class.php.
References _cleanObjectDatas(), _cleanUserGroup(), and getDolGlobalString().
Referenced by putGroups().
| Users::listGroups | ( | $sortfield = "t.rowid", | |
| $sortorder = 'ASC', | |||
| $limit = 100, | |||
| $page = 0, | |||
| $group_ids = '0', | |||
| $sqlfilters = '', | |||
| $properties = '' ) |
List groups of the current user (so user of API token)
Return an array with a list of Groups
@url GET /groups
| string | $sortfield | Sort field |
| string | $sortorder | Sort order |
| int | $limit | Limit for list |
| int | $page | Page number |
| string | $group_ids | Groups ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} |
| string | $sqlfilters | Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:>:'20160101')" |
| string | $properties | Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names |
| RestException | 403 Not allowed |
| RestException | 404 User not found |
| RestException | 503 Error |
Definition at line 806 of file api_users.class.php.
References _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), and getDolGlobalString().
| Users::post | ( | $request_data = null | ) |
Create a user.
| array | $request_data | New user data @phan-param ?array<string,mixed> $request_data @phpstan-param ?array<string,mixed> $request_data |
| RestException | 403 Not allowed |
Definition at line 343 of file api_users.class.php.
References DolibarrApi\_checkValForAPI(), and sanitizeVal().
| Users::postGroups | ( | $request_data = null | ) |
Create user group.
| array | $request_data | New user group data @phan-param ?array<string,mixed> $request_data @phpstan-param ?array<string,mixed> $request_data |
@url POST /groups
| RestException | 400 Bad Request |
| RestException | 403 Not allowed |
| RestException | 500 Server Error |
Definition at line 662 of file api_users.class.php.
References DolibarrApi\_checkValForAPI(), and sanitizeVal().
| Users::put | ( | $id, | |
| $request_data = null ) |
Update a user.
| int | $id | Id of account to update |
| array | $request_data | Datas @phan-param ?array<string,mixed> $request_data @phpstan-param ?array<string,mixed> $request_data |
| RestException | 403 Not allowed |
| RestException | 404 Not found |
| RestException | 500 System error |
Definition at line 412 of file api_users.class.php.
References $id, DolibarrApi\_checkAccessToResource(), DolibarrApi\_checkValExtrafieldsForAPI(), DolibarrApi\_checkValForAPI(), and sanitizeVal().
| Users::putGroups | ( | $group, | |
| $request_data = null ) |
Update user group.
| int | $group | Id of usergroup to update |
| array | $request_data | Datas @phan-param ?array<string,mixed> $request_data @phpstan-param ?array<string,mixed> $request_data |
@url PUT /groups/{group}
| RestException | 400 Bad Request |
| RestException | 403 Not allowed |
| RestException | 500 Server Error |
Definition at line 705 of file api_users.class.php.
References DolibarrApi\_checkValForAPI(), infoGroups(), and sanitizeVal().
| Users::removeUserFromGroup | ( | $id, | |
| $group ) |
Remove user from group (only admin)
@url POST {id}/remove-group/{group}
| int | $id | User ID |
| int | $group | Group ID |
| RestException | 403 Not allowed - only admin |
| RestException | 503 Error |
Definition at line 760 of file api_users.class.php.
References $id.
| Users::setGroup | ( | $id, | |
| $group, | |||
| $entity = 1 ) |
Add a user to a group.
| int | $id | User ID |
| int | $group | Group ID |
| int | $entity | Entity ID (valid only for superadmin in multicompany transverse mode) |
| RestException | 403 Not allowed |
| RestException | 404 User not found |
| RestException | 500 System error |
@url GET {id}/setGroup/{group}
Definition at line 616 of file api_users.class.php.
References $conf, $id, DolibarrApi\_checkAccessToResource(), getDolGlobalString(), and isModEnabled().
| Users::setPassword | ( | $id, | |
| $send_password = false ) |
Update a user password.
| int | $id | User ID |
| bool | $send_password | Only if set to true, the new password will send to the user |
| RestException | 403 Not allowed |
| RestException | 404 User not found |
| RestException | 500 System error |
@url GET {id}/setPassword
Definition at line 518 of file api_users.class.php.
References $id, DolibarrApi\_checkAccessToResource(), getDolGlobalInt(), and getDolGlobalString().
| Users::updateUserNotification | ( | $id, | |
| $notification_id, | |||
| $request_data = null ) |
Update a notification for a user.
| int | $id | ID of the User |
| int | $notification_id | ID of UserNotification |
| array | $request_data | Request data |
@phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
@url PUT {id}/notifications/{notification_id}
| RestException |
Definition at line 1251 of file api_users.class.php.
References $id, DolibarrApi\_checkValForAPI(), and _cleanObjectDatas().