- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
public static function checkUserRights($project, $user, $action, $allowView = false)
{
$action_id = Actions::getActionIdByName($action);
$user_role = ProjectsRoles::getUserRoleInProject($project, $user);
if(is_null($user_role))
HUtils::Exception(403);
$roles = Roles::getRolesOrderedByWeight();
$user_role = $user_role->role;
foreach($roles as $role)
{
if($role->weight <= $user_role)
{
$user_role -= $role->weight;
if(in_array($action_id,HUtils::Parse($role->actions)))
return 1;
}
}
if(!$allowView)
HUtils::Exception(403);
}
Функция проверки прав.
$allowView в конце функции намекает, что доступ получен не будет. Никогда. Вроде бы.