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


PHP ACL::key方法代码示例

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


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

示例1: key

 /**
  * Calulates the key of this rule based on its scope parts
  *
  * @return  string
  */
 public function key()
 {
     return ACL::key($this->directory, $this->controller, $this->action);
 }
开发者ID:synapsestudios,项目名称:kohana-acl,代码行数:9,代码来源:rule.php

示例2: compile

 /**
  * Compiles the rules based on the scope into a single rule.
  *
  * @return  void
  */
 protected function compile()
 {
     // Initialize an array for the applicable rules
     $applicable_rules = array();
     // Get the scope for this instance of ACL
     $scope = $this->scope();
     // Resolve rules that currently have wildcards
     ACL::resolve_rules($scope);
     // Re-index the scope array with numbers for looping
     $scope = array_values($scope);
     // Get all the rules that could apply to this request
     for ($i = 2; $i >= 0; $i--) {
         // Get the key for the scope
         $key = ACL::key($scope);
         // Look in the rules array for a rule matching the key
         if ($rule = Arr::get(self::$_rules, $key, FALSE)) {
             $applicable_rules[$key] = $rule;
         }
         // Remove part of the scope so the next iteration can cascade to another rule
         $scope[$i] = '';
     }
     // Get default rule
     $default_key = ACL::KEY_SEPARATOR . ACL::KEY_SEPARATOR;
     $applicable_rules[$default_key] = Arr::get(self::$_rules, $default_key);
     // Reverse the rules. Compile from the bottom up
     $applicable_rules = array_reverse($applicable_rules);
     // Compile the rule
     foreach ($applicable_rules as $rule) {
         $this->rule = Arr::overwrite($this->rule, $rule->as_array());
     }
 }
开发者ID:synapsestudios,项目名称:kohana-acl,代码行数:36,代码来源:acl.php


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