Move api that are admin features into a dedicated /admin api

This commit is contained in:
Laurent Destailleur 2017-11-06 09:45:15 +01:00
parent 34bd785785
commit 534c50f46e
4 changed files with 16 additions and 15 deletions

View File

@ -19,7 +19,8 @@ Following changes may create regressions for some external modules, but were nec
__PROPALREF__, ...)
* The substition key __SIGNATURE__ was renamed into __USER_SIGNATURE__ to standardize naming conventions.
* Substitution keys with syntax %XXX% were renamed into __XXX__ to match others.
* Some REST API to access the dictionary (country, town, ...) were moved into a common API.
* Some REST API to access setup features, like dictionaries (country, town, extrafields, ...) were moved into a
common API "/setup".
* Page bank/index.php and bank/bankentries.php were renamed into bank/list.php and bank/bankentries_list.php to
follow page naming conventions (so default filter/sort order features can also work).
* The trigger ORDER_SUPPLIER_STATUS_ONPROCESS was renamed into ORDER_SUPPLIER_STATUS_ORDERED

View File

@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php';
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
class Dictionary extends DolibarrApi
class Setup extends DolibarrApi
{
private $translations = null;
@ -53,7 +53,7 @@ class Dictionary extends DolibarrApi
* @param int $active Payment type is active or not {@min 0} {@max 1}
* @param string $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'CHQ')"
*
* @url GET payment/types
* @url GET dictionary/payment_types
*
* @return array [List of payment types]
*
@ -122,7 +122,7 @@ class Dictionary extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of countries
*
* @url GET countries
* @url GET dictionary/countries
*
* @throws RestException
*/
@ -188,7 +188,7 @@ class Dictionary extends DolibarrApi
* @param string $lang Code of the language the name of the
* country must be translated to
*
* @url GET countries/{id}
* @url GET dictionary/countries/{id}
*
* @throws RestException
*/
@ -212,7 +212,7 @@ class Dictionary extends DolibarrApi
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
{
@ -263,7 +263,7 @@ class Dictionary extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of events types
*
* @url GET events
* @url GET dictionary/event_types
*
* @throws RestException
*/
@ -402,7 +402,7 @@ class Dictionary extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of towns
*
* @url GET towns
* @url GET dictionary/towns
*
* @throws RestException
*/
@ -463,7 +463,7 @@ class Dictionary extends DolibarrApi
* @param int $active Payment term is active or not {@min 0} {@max 1}
* @param string $sqlfilters SQL criteria to filter. Syntax example "(t.code:=:'CHQ')"
*
* @url GET payment/terms
* @url GET dictionary/payment_terms
*
* @return array List of payment terms
*

View File

@ -21,7 +21,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
/**
* API that gives the status of the Dolibarr instance.
*
* @access protected
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
class Status
@ -30,10 +30,13 @@ class Status
* Get status (Dolibarr version)
*/
function index() {
global $conf;
return array(
'success' => array(
'code' => 200,
'dolibarr_version' => DOL_VERSION
'dolibarr_version' => DOL_VERSION,
'access_locked' => (empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)?'0':$conf->global->MAIN_ONLY_LOGIN_ALLOWED)
)
);
}

View File

@ -2198,10 +2198,7 @@ function getModuleDirForApiClass($module)
if ($module == 'contracts') {
$moduledirforclass = 'contrat';
}
elseif (in_array($module, array('login', 'access', 'status', 'documents'))) {
$moduledirforclass = 'api';
}
elseif (preg_match('/^dictionary/', $module)) {
elseif (in_array($module, array('login', 'setup', 'access', 'status', 'documents'))) {
$moduledirforclass = 'api';
}
elseif ($module == 'contact' || $module == 'contacts' || $module == 'customer' || $module == 'thirdparty' || $module == 'thirdparties') {