Ejemplo n.º 1
0
 protected function body()
 {
     if (!$this->isInputValid(array('id' => 'isIndex'))) {
         return false;
     }
     /**
      * @var $group \Group
      */
     $group = Repositories::findEntity(Repositories::Group, $this->getParams('id'));
     $user = User::instance();
     if (!$user->hasPrivileges(User::groupsManageAll) && (!$user->hasPrivileges(User::groupsManageOwn) || $user->getId() != $group->getOwner()->getId())) {
         return $this->death(StringID::InsufficientPrivileges);
     }
     RemovalManager::hideGroupAndItsAssignments($group);
     return true;
 }
Ejemplo n.º 2
0
 protected function body()
 {
     if (!$this->isInputValid(array('id' => 'isIndex'))) {
         return false;
     }
     /**
      * @var $lecture \Lecture
      */
     $lecture = Repositories::findEntity(Repositories::Lecture, $this->getParams('id'));
     $user = User::instance();
     if (!$user->hasPrivileges(User::lecturesManageAll) && (!$user->hasPrivileges(User::lecturesManageOwn) || $user->getId() != $lecture->getId())) {
         return $this->death(StringID::InsufficientPrivileges);
     }
     RemovalManager::hideLectureItsProblemsGroupsQuestionsAttachmentsAndXtests($lecture);
     return true;
 }
Ejemplo n.º 3
0
 protected function body()
 {
     if (!$this->userHasPrivileges(User::usersRemove)) {
         return false;
     }
     if (!$this->isInputSet('id')) {
         return false;
     }
     $id = $this->getParams('id');
     if ($id == User::instance()->getId()) {
         return $this->death(StringID::YouCannotRemoveYourself);
     }
     /** @var \User $user */
     $user = Repositories::findEntity(Repositories::User, $id);
     RemovalManager::hideUserAndAllHeOwns($user);
     return true;
 }
Ejemplo n.º 4
0
 protected function body()
 {
     if (!$this->isInputValid(array('id' => 'isIndex'))) {
         return false;
     }
     $id = $this->getParams('id');
     /**
      * @var $problem \Problem
      */
     $problem = Repositories::findEntity(Repositories::Problem, $id);
     $lecture = $problem->getLecture();
     $user = User::instance();
     if (!$user->hasPrivileges(User::lecturesManageAll) && (!$user->hasPrivileges(User::lecturesManageOwn) || $user->getId() != $lecture->getOwner())) {
         return $this->death(StringID::InsufficientPrivileges);
     }
     RemovalManager::hideProblemAndItsAssignments($problem);
     return true;
 }
 protected function body()
 {
     if (!$this->isInputValid(array('id' => 'isIndex'))) {
         return false;
     }
     $id = $this->getParams('id');
     /**
      * @var $attachment \Attachment
      */
     $attachment = Repositories::findEntity(Repositories::Attachment, $id);
     if (!$this->authorizedToManageLecture($attachment->getLecture())) {
         return false;
     }
     $folder = Config::get('paths', 'attachments');
     $file = $attachment->getFile();
     RemovalManager::deleteAttachmentById($id);
     Filesystem::removeFile($folder . $file);
     return true;
 }
Ejemplo n.º 6
0
 protected function body()
 {
     if (!$this->userHasPrivileges(User::pluginsRemove)) {
         return false;
     }
     if (!$this->isInputValid(array('id' => 'isIndex'))) {
         return false;
     }
     $id = $this->getParams('id');
     /**
      * @var $plugin \Plugin
      */
     $plugin = Repositories::findEntity(Repositories::Plugin, $id);
     $pluginFolder = Filesystem::combinePaths(Config::get('paths', 'plugins'), $plugin->getName());
     if (!Filesystem::removeDir($pluginFolder)) {
         return $this->death(StringID::FileSystemError);
     }
     RemovalManager::deletePluginById($id);
     return true;
 }