api_accounts fillApiPermissions if empty

This commit is contained in:
OpenXE 2023-12-15 19:03:16 +01:00
parent 53b228b06c
commit bef8e02217
2 changed files with 14716 additions and 14710 deletions

View File

@ -802,7 +802,7 @@ if (!function_exists('getallheaders')) {
return $permissions;
}
private function fillApiPermissions()
function fillApiPermissions()
{
foreach ($this->getGroupedPermissions() as $group => $permissions){
foreach ($permissions as $permission){

View File

@ -267,6 +267,12 @@ class Api_account
$apiPermissions = $this->app->DB->SelectArr("SELECT * FROM `api_permission`");
if (empty($apiPermissions)) {
$api = $this->app->loadModule('api');
$api->fillApiPermissions();
$apiPermissions = $this->app->DB->SelectArr("SELECT * FROM `api_permission`");
}
$groupedApiPermissions = [];
foreach ($apiPermissions as $apiPermission){
$groupedApiPermissions[$apiPermission['group']][] =$apiPermission;