dolibarr  21.0.0-alpha
Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
DolibarrApi Class Reference

Class for API REST v1. More...

Inheritance diagram for DolibarrApi:
Inheritance graph
[legend]

Public Member Functions

 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor. More...
 

Protected Member Functions

 _checkValForAPI ($field, $value, $object)
 Check and convert a string depending on its type/name. More...
 
 _filterObjectProperties ($object, $properties)
 Filter properties that will be returned on object. More...
 
 _cleanObjectDatas ($object)
 Clean sensible object datas. More...
 
 _checkFilters ($sqlfilters, &$error='')
 Return if a $sqlfilters parameter is valid Function no more used. More...
 

Static Protected Member Functions

static _checkAccessToResource ($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
 Check access by user to a given resource. More...
 
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria from a Generic filter string. 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 
)

Constructor.

Parameters
DoliDB$dbDatabase handler
string$cachedirCache dir
boolean$refreshCacheUpdate cache

Definition at line 48 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' 
)
staticprotected

Check access by user to a given resource.

Parameters
string$resourceelement to check
int$resource_idObject ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
string$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)
Returns
bool

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

◆ _checkFilters()

DolibarrApi::_checkFilters (   $sqlfilters,
$error = '' 
)
protected

Return if a $sqlfilters parameter is valid Function no more used.

Kept for backward compatibility with old APIs of modules

Parameters
string$sqlfilterssqlfilter string
string$errorError message
Returns
boolean|string True if valid, False if not valid

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

◆ _checkValForAPI()

DolibarrApi::_checkValForAPI (   $field,
  $value,
  $object 
)
protected

Check and convert a string depending on its type/name.

Parameters
string$fieldField name
string | array$valueValue to check/clean
Object$objectObject
Returns
string|array Value cleaned

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

◆ _cleanObjectDatas()

DolibarrApi::_cleanObjectDatas (   $object)
protected

◆ _filterObjectProperties()

DolibarrApi::_filterObjectProperties (   $object,
  $properties 
)
protected

Filter properties that will be returned on object.

Parameters
Object$objectObject to clean
String$propertiesComma separated list of properties names
Returns
Object Object with cleaned properties

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

References $object.

◆ _forge_criteria_callback()

static DolibarrApi::_forge_criteria_callback (   $matches)
staticprotected

Function to forge a SQL criteria from a Generic filter string.

Function no more used. Kept for backward compatibility with old APIs of modules

Parameters
array$matchesArray of found string by regex search. Each entry is 1 and only 1 criteria. Example: "t.ref:like:'SO-%'", "t.date_creation:<:'20160101'", "t.date_creation:<:'2016-01-01 12:30:00'", "t.nature:is:NULL", "t.field2:isnot:NULL"
Returns
string Forged criteria. Example: "t.field like 'abc%'"

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

References dolForgeCriteriaCallback().


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