Exemplo n.º 1
0
 /**
  * Checks whether the active user is authorized to manage the specified lecture.
  * @param \Lecture $lecture The lecture the active user wants to manage.
  * @return bool True, if the user is authorized.
  */
 protected function authorizedToManageLecture(\Lecture $lecture)
 {
     $user = User::instance();
     if ($user->hasPrivileges(User::lecturesManageAll)) {
         return true;
     }
     if ($user->hasPrivileges(User::lecturesManageOwn && $lecture->getOwner()->getId() === User::instance()->getId())) {
         return true;
     }
     return false;
 }