dolibarr  7.0.0-beta
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

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

Constructor.

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

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

Member Function Documentation

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

Check user access to a resource.

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).
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)
Exceptions
RestException

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

References checkUserAccessToObject().

Referenced by Contracts\activateLine(), Thirdparties\addCategory(), Invoices\addPayment(), Tasks\addTimeSpent(), Contracts\close(), Proposals\close(), Orders\close(), Contacts\createUser(), Warehouses\delete(), MembersTypes\delete(), Categories\delete(), Products\delete(), Members\delete(), Thirdparties\delete(), SupplierInvoices\delete(), MyModuleApi\delete(), SupplierOrders\delete(), Contacts\delete(), AgendaEvents\delete(), Users\delete(), ExpenseReports\delete(), Shipments\delete(), Orders\delete(), Projects\delete(), Invoices\delete(), Tasks\delete(), Proposals\delete(), Contracts\delete(), Orders\deleteLine(), Shipments\deleteLine(), Proposals\deleteLine(), Invoices\deleteLine(), Contracts\deleteLine(), MembersTypes\get(), Members\get(), Invoices\get(), Warehouses\get(), SupplierInvoices\get(), SupplierOrders\get(), AgendaEvents\get(), Orders\get(), ExpenseReports\get(), Proposals\get(), Supplierproposals\get(), Shipments\get(), Projects\get(), Tasks\get(), Contracts\get(), Products\get(), Contacts\get(), Thirdparties\get(), Categories\get(), MyModuleApi\get(), Users\get(), Thirdparties\getFixedAmountDiscounts(), Thirdparties\getInvoicesQualifiedForCreditNote(), Thirdparties\getInvoicesQualifiedForReplacement(), Proposals\getLines(), Projects\getLines(), Orders\getLines(), Contracts\getLines(), Invoices\getLines(), Invoices\getPayments(), Projects\getRoles(), Tasks\getRoles(), Proposals\postLine(), Orders\postLine(), Contracts\postLine(), Invoices\postLine(), MembersTypes\put(), Warehouses\put(), Members\put(), Users\put(), Categories\put(), Products\put(), Thirdparties\put(), SupplierInvoices\put(), MyModuleApi\put(), Contacts\put(), SupplierOrders\put(), ExpenseReports\put(), Orders\put(), Shipments\put(), Proposals\put(), Invoices\put(), Projects\put(), Tasks\put(), Contracts\put(), Contracts\putLine(), Orders\putLine(), Proposals\putLine(), Invoices\putLine(), Users\setGroup(), Orders\setinvoiced(), Proposals\setinvoiced(), Proposals\settodraft(), Invoices\settodraft(), Orders\settodraft(), Invoices\settopaid(), Invoices\settounpaid(), Contracts\unactivateLine(), Invoices\useCreditNote(), Invoices\useDiscount(), SupplierInvoices\validate(), SupplierOrders\validate(), Shipments\validate(), Projects\validate(), Orders\validate(), Contracts\validate(), Proposals\validate(), and Invoices\validate().

DolibarrApi::_checkFilters (   $sqlfilters)
DolibarrApi::_cleanObjectDatas (   $object)

Executed method when API is called without parameter.

Display a short message an return a http code 200

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

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

Referenced by Subscriptions\get(), MyModuleApi\get(), and Subscriptions\index().

static DolibarrApi::_forge_criteria_callback (   $matches)
static

Function to forge a SQL criteria.

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

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


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