/**
  * Registers the groups as access levels.
  * 
  * @access public
  * @param \Zepi\Turbo\Framework $framework
  * @param \Zepi\Turbo\Request\RequestAbstract $request
  * @param \Zepi\Turbo\Response\Response $response
  * @param mixed $value
  * @return mixed
  */
 public function execute(Framework $framework, RequestAbstract $request, Response $response, $value = null)
 {
     $accessLevels = $value;
     $dataRequest = new DataRequest(1, 0, 'name', 'ASC');
     foreach ($this->groupManager->find($dataRequest) as $group) {
         $accessLevels[] = new GroupAccessLevel('\\Group\\' . $group->getUuid(), $this->translationManager->translate('Group', '\\Zepi\\Web\\AccessControl') . ' ' . $group->getName(), $this->translationManager->translate('Inherits all permissions from this group.', '\\Zepi\\Web\\AccessControl'), '\\Group');
     }
     return $accessLevels;
 }
Esempio n. 2
0
 /**
  * Validates the group data.
  * 
  * @access protected
  * @param \Zepi\Web\AccessControl\Entity\Group $group
  * @param string $groupname
  */
 protected function validateData(EntityGroup $group, $groupname)
 {
     $errors = array();
     // Groupname
     if ($this->groupManager->hasGroupForName($groupname) && $this->groupManager->getGroupForName($groupname)->getUuid() != $group->getUuid()) {
         $errors[] = new Error(Error::GENERAL_ERROR, $this->translate('The groupname is already in use.', '\\Zepi\\Web\\AccessControl'));
     }
     if (count($errors) > 0) {
         return $errors;
     }
     return true;
 }
Esempio n. 3
0
 /**
  * Displays the edit user form and saves the data to the database.
  * 
  * @access public
  * @param \Zepi\Turbo\Framework $framework
  * @param \Zepi\Turbo\Request\WebRequest $request
  * @param \Zepi\Turbo\Response\Response $response
  */
 public function execute(Framework $framework, WebRequest $request, Response $response)
 {
     // Prepare the page
     $additionalTitle = $this->translate('Delete group', '\\Zepi\\Web\\AccessControl');
     $title = $this->translate('Group management', '\\Zepi\\Web\\AccessControl');
     $this->activateMenuEntry('group-administration');
     $this->setTitle($title, $additionalTitle);
     // Get the user
     $uuid = $request->getRouteParam('uuid');
     // If the UUID does not exists redirect to the overview page
     if (!is_string($uuid) || !$this->groupManager->hasGroupForUuid($uuid)) {
         $response->redirectTo($request->getFullRoute('/administration/groups/'));
         return;
     }
     $group = $this->groupManager->getGroupForUuid($uuid);
     // If $result isn't true, display the edit user form
     if ($request->getRouteParam('confirmation') === 'confirmed') {
         $this->groupManager->deleteGroup($group);
         $response->setOutput($this->render('\\Zepi\\Web\\AccessControl\\Templates\\Administration\\DeleteGroupFinished', array('group' => $group)));
     } else {
         // Display the delete user confirmation
         $response->setOutput($this->render('\\Zepi\\Web\\AccessControl\\Templates\\Administration\\DeleteGroup', array('group' => $group)));
     }
 }