This commit is contained in:
Frédéric FRANCE
2019-02-25 20:35:59 +01:00
parent 42a1387218
commit 1c07006015
125 changed files with 3394 additions and 3402 deletions

View File

@@ -44,7 +44,7 @@ class Users extends DolibarrApi
/**
* Constructor
*/
function __construct()
public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -65,7 +65,7 @@ class Users extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of User objects
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '')
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '')
{
global $db, $conf;
@@ -139,7 +139,7 @@ class Users extends DolibarrApi
*
* @throws RestException
*/
function get($id)
public function get($id)
{
//if (!DolibarrApiAccess::$user->rights->user->user->lire) {
//throw new RestException(401);
@@ -166,7 +166,7 @@ class Users extends DolibarrApi
* @param array $request_data New user data
* @return int
*/
function post($request_data = null)
public function post($request_data = null)
{
// check user authorization
//if(! DolibarrApiAccess::$user->rights->user->creer) {
@@ -201,7 +201,7 @@ class Users extends DolibarrApi
*
* @throws RestException
*/
function put($id, $request_data = null)
public function put($id, $request_data = null)
{
//if (!DolibarrApiAccess::$user->rights->user->user->creer) {
//throw new RestException(401);
@@ -256,7 +256,7 @@ class Users extends DolibarrApi
*
* @url GET {id}/groups
*/
function getGroups($id)
public function getGroups($id)
{
$obj_ret = array();
@@ -290,7 +290,7 @@ class Users extends DolibarrApi
*
* @url GET {id}/setGroup/{group}
*/
function setGroup($id, $group, $entity = 1)
public function setGroup($id, $group, $entity = 1)
{
global $conf;
@@ -335,7 +335,7 @@ class Users extends DolibarrApi
* @param int $id Account ID
* @return array
*/
function delete($id)
public function delete($id)
{
//if (!DolibarrApiAccess::$user->rights->user->user->supprimer) {
//throw new RestException(401);
@@ -360,7 +360,7 @@ class Users extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
private function _cleanObjectDatas($object)
{
global $conf;
@@ -418,16 +418,15 @@ class Users extends DolibarrApi
* @param array|null $data Data to validate
* @return array
* @throws RestException
*/
function _validate($data)
*/
private function _validate($data)
{
$account = array();
foreach (Users::$FIELDS as $field)
{
if (!isset($data[$field]))
throw new RestException(400, "$field field missing");
$account[$field] = $data[$field];
}
return $account;
}
$account = array();
foreach (Users::$FIELDS as $field) {
if (!isset($data[$field]))
throw new RestException(400, "$field field missing");
$account[$field] = $data[$field];
}
return $account;
}
}