diff --git a/app/Controller/PermissionsController.php b/app/Controller/PermissionsController.php index de53bcb1..015d4f06 100755 --- a/app/Controller/PermissionsController.php +++ b/app/Controller/PermissionsController.php @@ -13,16 +13,36 @@ function admin_index() $this->layout = 'admin'; $this->loadModel('Rank'); - $custom_ranks = $this->Rank->find('all'); - $this->set(compact('custom_ranks')); + $all_ranks = [ + [ + "Rank" => [ + 'rank_id' => 0, + 'name' => $this->Lang->get('GLOBAL__TYPE_NORMAL'), + ], + ], + [ + "Rank" => [ + 'rank_id' => 2, + 'name' => $this->Lang->get('USER__RANK_MODERATOR'), + ], + ], + ]; + + $all_ranks = array_merge($all_ranks, $this->Rank->find('all')); + $this->set(compact('all_ranks')); if ($this->request->is('post')) { $permissions = []; + + foreach ($all_ranks as $rank) { + $rank = $rank['Rank']; + $permissions[$rank['rank_id']] = []; + } + foreach ($this->request->data as $permission => $checked) { - if(is_array($checked)) + if (is_array($checked)) continue; - list($permission, $rank) = explode('-', $permission); $permissions[$rank][] = $permission; } diff --git a/app/View/Permissions/admin_index.ctp b/app/View/Permissions/admin_index.ctp index 452bc893..1d0da453 100755 --- a/app/View/Permissions/admin_index.ctp +++ b/app/View/Permissions/admin_index.ctp @@ -15,20 +15,19 @@