dolibarr  9.0.0
Public Member Functions | Static Public Member Functions | List of all members
DolibarrApi Class Reference

Class for API REST v1. More...

+ Inheritance diagram for DolibarrApi:
+ Collaboration diagram for DolibarrApi:

Public Member Functions

 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor. More...
 _cleanObjectDatas ($object)
 Executed method when API is called without parameter. More...
 _checkFilters ($sqlfilters)
 Return if a $sqlfilters parameter is valid. More...

Static Public Member Functions

static _checkAccessToResource ($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
 Check user access to a resource. More...
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria. More...

Detailed Description

Class for API REST v1.

Definition at line 29 of file api.class.php.

Constructor & Destructor Documentation

◆ __construct()

DolibarrApi::__construct (   $db,
  $cachedir = '',
  $refreshCache = false 


DoliDb$dbDatabase handler
string$cachedirCache dir
boolean$refreshCacheUpdate cache

Definition at line 49 of file api.class.php.

Member Function Documentation

◆ _checkAccessToResource()

static DolibarrApi::_checkAccessToResource (   $resource,
  $resource_id = 0,
  $dbtablename = '',
  $feature2 = '',
  $dbt_keyfield = 'fk_soc',
  $dbt_select = 'rowid' 

Check user access to a resource.

Check access by user to a given resource

string$resourceelement to check
int$resource_idObject ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
type$dbtablename'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
string$feature2Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
string$dbt_keyfieldField name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
string$dbt_selectField name for select if not rowid. Not used if objectid is null (optional)

Definition at line 225 of file api.class.php.

◆ _checkFilters()

DolibarrApi::_checkFilters (   $sqlfilters)

Return if a $sqlfilters parameter is valid.

string$sqlfilterssqlfilter string
boolean True if valid, False if not valid

Definition at line 251 of file api.class.php.

◆ _cleanObjectDatas()

DolibarrApi::_cleanObjectDatas (   $object)

Executed method when API is called without parameter.

Display a short message an return a http code 200

array Clean sensible object datas
object$objectObject to clean
array Array of cleaned object properties

Definition at line 97 of file api.class.php.

◆ _forge_criteria_callback()

static DolibarrApi::_forge_criteria_callback (   $matches)

Function to forge a SQL criteria.

array$matchesArray of found string by regex search
string Forged criteria. Example: "t.field like 'abc%'"

Definition at line 281 of file api.class.php.

The documentation for this class was generated from the following file: