mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'fix/rbac_init' into 'main'
Comprobar que el directorio RBAC existe y añadido .gitkeep See merge request jjimenez/safekat!694
This commit is contained in:
@ -29,8 +29,12 @@ if (!function_exists('generate_php_roles_constant')) {
|
|||||||
// Close the array
|
// Close the array
|
||||||
$phpCode .= "];\n";
|
$phpCode .= "];\n";
|
||||||
|
|
||||||
// Write PHP code to a file
|
$dirPath = APPPATH . "Config/RBAC";
|
||||||
$filePath = APPPATH . "Config/RBAC/roles.php";
|
if (!is_dir($dirPath)) {
|
||||||
|
mkdir($dirPath, 0775, true); // true permite crear carpetas anidadas
|
||||||
|
}
|
||||||
|
|
||||||
|
$filePath = $dirPath . "/roles.php";
|
||||||
file_put_contents($filePath, $phpCode);
|
file_put_contents($filePath, $phpCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -58,9 +62,14 @@ if (!function_exists('generate_php_permissions_constant')) {
|
|||||||
// Close the array
|
// Close the array
|
||||||
$phpCode .= "];\n";
|
$phpCode .= "];\n";
|
||||||
|
|
||||||
// Write PHP code to a file
|
$dirPath = APPPATH . "Config/RBAC";
|
||||||
$filePath = APPPATH . "Config/RBAC/permissions.php";
|
if (!is_dir($dirPath)) {
|
||||||
|
mkdir($dirPath, 0775, true); // true permite crear carpetas anidadas
|
||||||
|
}
|
||||||
|
|
||||||
|
$filePath = $dirPath . "/permissions.php";
|
||||||
file_put_contents($filePath, $phpCode);
|
file_put_contents($filePath, $phpCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,8 +96,12 @@ if (!function_exists('generate_php_permissions_matrix_constant')) {
|
|||||||
// Close the array
|
// Close the array
|
||||||
$phpCode .= "];\n";
|
$phpCode .= "];\n";
|
||||||
|
|
||||||
// Write PHP code to a file
|
$dirPath = APPPATH . "Config/RBAC";
|
||||||
$filePath = APPPATH . "Config/RBAC/permissionMatrix.php";
|
if (!is_dir($dirPath)) {
|
||||||
|
mkdir($dirPath, 0775, true); // true permite crear carpetas anidadas
|
||||||
|
}
|
||||||
|
|
||||||
|
$filePath = $dirPath . "/permissionMatrix.php";
|
||||||
file_put_contents($filePath, $phpCode);
|
file_put_contents($filePath, $phpCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,9 +143,9 @@ if (!function_exists('checkGroups')) {
|
|||||||
*/
|
*/
|
||||||
function checkGroups(array $groups, string $redirectRoute = null)
|
function checkGroups(array $groups, string $redirectRoute = null)
|
||||||
{
|
{
|
||||||
$session = \Config\Services::session();
|
$session = \Config\Services::session();
|
||||||
$response = \Config\Services::response();
|
$response = \Config\Services::response();
|
||||||
$auth = auth(); // Shield auth service
|
$auth = auth(); // Shield auth service
|
||||||
|
|
||||||
$user = $auth->user();
|
$user = $auth->user();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user