24 lines
545 B
PHP
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;
|
|
}
|
|
}
|
|
}
|