Exemple #1
0
 /**
  * Test {@link Factory::getActionDescription}
  *
  * @dataProvider controllerActionNameProvider
  * @param string $controllerClassName
  * @param string $actionName
  * @param string $descriptionStub
  * @param array  $rightsStub
  */
 public function testGetActionDescription($controllerClassName, $actionName, $descriptionStub, $rightsStub)
 {
     $description = $this->factory->getActionDescription($controllerClassName, $actionName);
     $this->assertTrue($description instanceof ActionDescription);
     $this->assertEquals($actionName, $description->getName());
     $this->assertEquals($descriptionStub, $description->getDescription());
     $this->assertEquals($rightsStub, $description->getRequiredRights());
 }
Exemple #2
0
 /**
  * Get the required rights for the execution of an action
  *
  * Returns an associative array with the parameter as key
  * and the rights as values
  *
  * @param string $controllerClassName
  * @param string $actionName
  * @return array
  */
 public static function getRequiredRights($controllerClassName, $actionName)
 {
     try {
         $rights = ServiceManager::getServiceManager()->get('generis/cache')->get(self::ACTION_PREFIX . $controllerClassName . '@' . $actionName);
     } catch (\common_cache_NotFoundException $e) {
         $factory = new Factory();
         $controller = $factory->getActionDescription($controllerClassName, $actionName);
         $rights = $controller->getRequiredRights();
         ServiceManager::getServiceManager()->get('generis/cache')->put($rights, self::ACTION_PREFIX . $controllerClassName . '@' . $actionName);
     }
     return $rights;
 }
 /**
  * Get the required rights for the execution of an action
  *
  * Returns an associative array with the parameter as key
  * and the rights as values
  *
  * @param string $controllerClassName
  * @param string $actionName
  * @return array
  */
 public static function getRequiredRights($controllerClassName, $actionName)
 {
     try {
         $rights = \common_cache_FileCache::singleton()->get(self::ACTION_PREFIX . $controllerClassName . '@' . $actionName);
     } catch (\common_cache_NotFoundException $e) {
         $factory = new Factory();
         $controller = $factory->getActionDescription($controllerClassName, $actionName);
         $rights = $controller->getRequiredRights();
         \common_cache_FileCache::singleton()->put($rights, self::ACTION_PREFIX . $controllerClassName . '@' . $actionName);
     }
     return $rights;
 }