FleetCart/Modules/User/helpers.php
2023-06-11 13:14:03 +01:00

24 lines
545 B
PHP

<?php
if (! function_exists('permission_value')) {
/**
* Get the integer representation value of the permission.
*
* @param array $permissions
* @param string $permission
* @return int
*/
function permission_value(array $permissions, $permission)
{
$value = array_get($permissions, $permission);
if (is_null($value)) {
return 0;
} elseif ($value) {
return 1;
} elseif (! $value) {
return -1;
}
}
}