NEW: API_LOGINS_ALLOWED_FOR_GET_EXTRAFIELD (#30562)

* introducing new global variable API_LOGINS_ALLOWED_FOR_GET_EXTRAFIELDS, code copied and modified from public function getModules()

* trying to use a different method to read the variable

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
This commit is contained in:
Jon Bendtsen
2024-08-11 00:06:00 +02:00
committed by GitHub
parent b974951a90
commit f1678b7524

View File

@@ -1199,8 +1199,9 @@ class Setup extends DolibarrApi
{
$list = array();
if (!DolibarrApiAccess::$user->admin) {
throw new RestException(403, 'Only an admin user can get list of extrafields');
if (!DolibarrApiAccess::$user->admin
&& (!getDolGlobalString('API_LOGINS_ALLOWED_FOR_GET_EXTRAFIELDS') || DolibarrApiAccess::$user->login != getDolGlobalString('API_LOGINS_ALLOWED_FOR_GET_EXTRAFIELDS'))) {
throw new RestException(403, 'Error API open to admin users only or to the users with logins defined into constant API_LOGINS_ALLOWED_FOR_GET_EXTRAFIELDS');
}
if ($elementtype == 'thirdparty') {