当前位置: 首页>>代码示例>>PHP>>正文


PHP Acl::allow方法代码示例

本文整理汇总了PHP中Acl::allow方法的典型用法代码示例。如果您正苦于以下问题:PHP Acl::allow方法的具体用法?PHP Acl::allow怎么用?PHP Acl::allow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Acl的用法示例。


在下文中一共展示了Acl::allow方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

    public function setUp()
    {
        // authentication service
        $this->authentication = new AuthenticationService;

        // authorization service
        $this->authorization = new AclAuthorization();
        $this->authorization->addRole('guest');
        $this->authorization->allow();

        // event for mvc and mvc-auth
        $routeMatch = new RouteMatch(array());
        $request    = new HttpRequest();
        $response   = new HttpResponse();
        $application = new Application(null, new ServiceManager(new Config(array('services' => array(
            'event_manager' => new EventManager(),
            'authentication' => $this->authentication,
            'authorization' => $this->authorization,
            'request' => $request,
            'response' => $response
        )))));

        $mvcEvent   = new MvcEvent();
        $mvcEvent->setRequest($request)
            ->setResponse($response)
            ->setRouteMatch($routeMatch)
            ->setApplication($application);

        $this->mvcAuthEvent = new MvcAuthEvent($mvcEvent, $this->authentication, $this->authorization);

        $this->listener = new DefaultAuthorizationListener($this->authorization);
    }
开发者ID:jbarentsen,项目名称:drb,代码行数:32,代码来源:DefaultAuthorizationListenerTest.php

示例2: addSongbookPrivileges

 /**
  * Sets up permissions for the module
  *
  * @param \Acl $acl
  */
 public static function addSongbookPrivileges($acl)
 {
     $acl->addRole('songbook - vstup');
     $acl->addRole('songbook - vytváření/editace', 'songbook - vstup');
     $acl->addRole('songbook - mazání', 'songbook - vytváření/editace');
     $acl->addResource("Oddil:Songbook");
     $acl->allow("base - člen", "Oddil:Songbook", "display");
     $acl->allow("songbook - vstup", "Oddil:Songbook", "default");
     $acl->allow("songbook - vytváření/editace", "Oddil:Songbook", ["add", "edit"]);
     $acl->allow("songbook - mazání", "Oddil:Songbook", "delete");
 }
开发者ID:patrickkusebauch,项目名称:27skauti,代码行数:16,代码来源:OddilModule.php

示例3: createService

 /**
  * Create the form-service
  *
  * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator
  * @return \Zend\Permissions\Acl\Acl
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     // Configure the locale
     $config = $serviceLocator->get('Configuration');
     $srvConfig = isset($config['acl']) ? $config['acl'] : array();
     $acl = new Acl();
     if (!empty($srvConfig['roles'])) {
         foreach ((array) $srvConfig['roles'] as $role => $parents) {
             $acl->addRole((string) $role, $parents);
         }
     }
     if (!empty($srvConfig['resources'])) {
         foreach ((array) $srvConfig['resources'] as $resource => $parent) {
             $acl->addResource($resource, $parent);
         }
     }
     if (!empty($srvConfig['allow'])) {
         foreach ((array) $srvConfig['allow'] as $allow) {
             $acl->allow($allow['role'], $allow['resource'], $allow['privilege']);
         }
     }
     if (!empty($srvConfig['deny'])) {
         foreach ((array) $srvConfig['deny'] as $deny) {
             $acl->deny($deny['role'], $deny['resource'], $deny['privilege']);
         }
     }
     return $acl;
 }
开发者ID:gridguyz,项目名称:zork,代码行数:34,代码来源:AclServiceFactory.php

示例4: GetFromCached

 public static function GetFromCached()
 {
     $mem = Cache::getInstance();
     if (!$mem->get("allow")) {
         return false;
     }
     self::$allow = $mem->get("allow");
     self::$parents = $mem->get("parents");
     self::$Rolelist = $mem->get("role");
 }
开发者ID:RaoHai,项目名称:picpic,代码行数:10,代码来源:acl.php

示例5: setUp

 public function setUp()
 {
     // authentication service
     $this->authentication = new AuthenticationService();
     // authorization service
     $this->authorization = new AclAuthorization();
     $this->authorization->addRole('guest');
     $this->authorization->allow();
     // event for mvc and mvc-auth
     $routeMatch = $this->createRouteMatch([]);
     $request = new HttpRequest();
     $response = new HttpResponse();
     $container = new ServiceManager();
     (new Config(['services' => ['EventManager' => new EventManager(), 'Authentication' => $this->authentication, 'Authorization' => $this->authorization, 'Request' => $request, 'Response' => $response]]))->configureServiceManager($container);
     $application = $this->applicationFactory($container);
     $mvcEvent = new MvcEvent();
     $mvcEvent->setRequest($request)->setResponse($response)->setRouteMatch($routeMatch)->setApplication($application);
     $this->mvcAuthEvent = new MvcAuthEvent($mvcEvent, $this->authentication, $this->authorization);
     $this->listener = new DefaultAuthorizationListener($this->authorization);
 }
开发者ID:zfcampus,项目名称:zf-mvc-auth,代码行数:20,代码来源:DefaultAuthorizationListenerTest.php

示例6: set_allow

 /**
  * Set allow on $acl object
  *
  * @param Acl $acl
  */
 public function set_allow($acl)
 {
     // allow
     foreach ($this->_environments as $environment) {
         foreach ($this->_allow as $role => $rights) {
             foreach ($rights as $resource => $privileges) {
                 foreach ($privileges as $privilege) {
                     if (is_array($privilege)) {
                         $own = isset($privilege[1]) && $privilege[1] === true ? true : false;
                         $privilege = $privilege[0];
                     } else {
                         $own = false;
                     }
                     $acl->allow($role, $resource, $privilege, $own, (string) $environment);
                 }
             }
         }
     }
 }
开发者ID:yubinchen18,项目名称:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代码行数:24,代码来源:Rights.php

示例7: set_allow

 /**
  * Set allow on $acl object
  *
  * @param Acl $acl
  */
 public function set_allow($acl)
 {
     // allow
     foreach ($this->_environments as $environment) {
         foreach ($this->_allow as $role => $rights) {
             // manager-rights are automatically only for only one website
             if ($role == 'manager') {
                 $role = 'manager_' . $environment;
             }
             // set allow rights on role
             foreach ($rights as $resource => $privileges) {
                 foreach ($privileges as $privilege) {
                     if (is_array($privilege)) {
                         $own = isset($privilege[1]) && $privilege[1] === true ? true : false;
                         $privilege = $privilege[0];
                     } else {
                         $own = false;
                     }
                     $acl->allow($role, $resource, $privilege, $own, (string) $environment);
                 }
             }
         }
     }
 }
开发者ID:yubinchen18,项目名称:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代码行数:29,代码来源:Rights.php

示例8: addVIPChroniclePermissions

 /**
  * @param \Acl $acl
  */
 private function addVIPChroniclePermissions($acl)
 {
     $acl->addRole('vip - vstup');
     $acl->addRole('vip - vytváření/editace', 'vip - vstup');
     $acl->addRole('vip - popisky', 'vip - vytváření/editace');
     $acl->addRole('vip - generování', 'vip - popisky');
     $acl->addRole('vip - zobrazování', 'vip - generování');
     $acl->addRole('vip - mazání', 'vip - zobrazování');
     $acl->addResource(self::MODULE_NAME . ':Admin:Vipchronicle');
     $acl->allow('vip - vstup', self::MODULE_NAME . ':Admin:Vipchronicle', 'default');
     $acl->allow('vip - vytváření/editace', self::MODULE_NAME . ':Admin:Vipchronicle', 'create');
     $acl->allow('vip - vytváření/editace', self::MODULE_NAME . ':Admin:Vipchronicle', 'edit');
     $acl->allow('vip - popisky', self::MODULE_NAME . ':Admin:Vipchronicle', 'photos');
     $acl->allow('vip - generování', self::MODULE_NAME . ':Admin:Vipchronicle', 'generate');
     $acl->allow('vip - zobrazování', self::MODULE_NAME . ':Admin:Vipchronicle', 'show');
     $acl->allow('vip - mazání', self::MODULE_NAME . ':Admin:Vipchronicle', 'delete');
 }
开发者ID:patrickkusebauch,项目名称:27skauti,代码行数:20,代码来源:DefaultModule.php

示例9: setAcl

 /**
  * Установить acl
  * @param Acl $acl
  * @return Auth
  */
 public function setAcl($acl)
 {
     if ($this->hasIdentity()) {
         $acl->allow('guest', 'autharea', 'signout');
         $acl->deny('guest', 'autharea', array('signin', 'signup'));
     }
     $this->_acl = $acl;
     return $this;
 }
开发者ID:eugenzor,项目名称:zfhrtool,代码行数:14,代码来源:Auth.php


注:本文中的Acl::allow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。