Añadido helper para crear los archivos de costantes de RBAC

This commit is contained in:
imnavajas
2024-05-06 13:34:16 +02:00
parent 122e194b16
commit 7492616dc6
15 changed files with 363 additions and 118 deletions

View File

@ -14,6 +14,8 @@ declare(strict_types=1);
namespace Config;
require "RBAC/roles.php";
require "RBAC/permissions.php";
require "RBAC/permissionMatrix.php";
use CodeIgniter\Shield\Config\AuthGroups as ShieldAuthGroups;
@ -25,7 +27,7 @@ class AuthGroups extends ShieldAuthGroups
* --------------------------------------------------------------------
* The group that a newly registered user is added to.
*/
public string $defaultGroup = 'user';
public string $defaultGroup = 'cliente';
/**
* --------------------------------------------------------------------
@ -52,16 +54,7 @@ class AuthGroups extends ShieldAuthGroups
*
* If a permission is not listed here it cannot be used.
*/
public array $permissions = [
'admin.access' => 'Can access the sites admin area',
'admin.settings' => 'Can access the main site settings',
'users.manage-admins' => 'Can manage other admins',
'users.list' => 'Can list user stuff',
'users.create' => 'Can create new non-admin users',
'users.edit' => 'Can edit existing non-admin users',
'users.delete' => 'Can delete existing non-admin users',
'beta.access' => 'Can access beta-level features',
];
public array $permissions = SK_PERMISSIONS;
/**
* --------------------------------------------------------------------
@ -71,31 +64,5 @@ class AuthGroups extends ShieldAuthGroups
*
* This defines group-level permissions.
*/
public array $matrix = [
"superadmin"=> [
"admin.*",
"users.*",
"beta.*"
],
"admin"=> [
"admin.access",
"users.create",
"users.edit",
"users.delete",
"beta.access"
],
"developer"=> [
"admin.access",
"admin.settings",
"users.create",
"users.edit",
"beta.access"
],
"user"=> [
"users.list"
],
"beta"=> [
"beta.access"
]
];
public array $matrix = SK_PERMISSION_MATRIX;
}