You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
442 B
PHP
23 lines
442 B
PHP
<?php
|
|
|
|
namespace BusinessLogic\Security;
|
|
|
|
|
|
class PermissionChecker {
|
|
/**
|
|
* @param $userContext UserContext
|
|
* @param $permission string
|
|
* @return bool
|
|
*/
|
|
function doesUserHavePermission($userContext, $permission) {
|
|
if ($userContext->admin) {
|
|
return true;
|
|
}
|
|
|
|
if (in_array($permission, $userContext->permissions)) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
} |