FleetCart/Modules/User/helpers.php

24 lines
545 B
PHP
Raw Permalink Normal View History

2023-06-11 12:14:03 +00:00
<?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;
}
}
}