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