Пример #1
0
/**
 * Check if the user has permission to perform the action.
 *
 * @param integer $projectId
 * @param string  $action
 *
 * @return boolean
 */
function has_permission($action, $projectId = null, $fetchProjectRoles = false)
{
    if (!$projectId) {
        $currentProject = current_project();
        $projectId = $currentProject['id'];
    }
    if (!($user = current_user())) {
        $user = anonymous_user();
    }
    return $user->hasPermission($action, $projectId, $fetchProjectRoles);
}
Пример #2
0
 /**
  * Check if the user has permisison to perform the action.
  *
  * @param integer $projectId
  * @param string  $action
  *
  * @return boolean
  */
 protected function hasPermission($action, $projectId = null)
 {
     if (!$projectId) {
         $projectId = $this->currentProject['id'];
     }
     if (!($user = current_user())) {
         $user = anonymous_user();
     }
     return $user->hasPermission($action, $projectId);
 }