[ Index ]
 

Code source de CakePHP 1.1.13.4450

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/cake/libs/controller/components/ -> acl.php (source)

   1  <?php
   2  /* SVN FILE: $Id: acl.php 4409 2007-02-02 13:20:59Z phpnut $ */
   3  /**
   4   * Access Control List factory class.
   5   *
   6   * Permissions system.
   7   *
   8   * PHP versions 4 and 5
   9   *
  10   * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/>
  11   * Copyright 2005-2007, Cake Software Foundation, Inc.
  12   *                                1785 E. Sahara Avenue, Suite 490-204
  13   *                                Las Vegas, Nevada 89104
  14   *
  15   * Licensed under The MIT License
  16   * Redistributions of files must retain the above copyright notice.
  17   *
  18   * @filesource
  19   * @copyright        Copyright 2005-2007, Cake Software Foundation, Inc.
  20   * @link                http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
  21   * @package            cake
  22   * @subpackage        cake.cake.libs.controller.components
  23   * @since            CakePHP(tm) v 0.10.0.1076
  24   * @version            $Revision: 4409 $
  25   * @modifiedby        $LastChangedBy: phpnut $
  26   * @lastmodified    $Date: 2007-02-02 07:20:59 -0600 (Fri, 02 Feb 2007) $
  27   * @license            http://www.opensource.org/licenses/mit-license.php The MIT License
  28   */
  29  /**
  30   * Access Control List factory class.
  31   *
  32   * Looks for ACL implementation class in core config, and returns an instance of that class.
  33   *
  34   * @package        cake
  35   * @subpackage    cake.cake.libs.controller.components
  36   */
  37  class AclComponent extends Object {
  38  /**
  39   * Instance of ACL_CLASSNAME set in app/config/core.php
  40   *
  41   * @var object
  42   */
  43      var $_instance = null;
  44  /**
  45   * Enter description here...
  46   *
  47   * @var boolean
  48   */
  49      var $controller = true;
  50  /**
  51   * Constructor.
  52   *
  53   * Will return an instance of the correct ACL class.
  54   */
  55  	function __construct() {
  56          $this->getACL();
  57      }
  58  /**
  59   * Static function used to gain an instance of the correct ACL class.
  60   *
  61   * @return object instance of ACL_CLASSNAME set in app/config/core.php
  62   * @access public
  63   */
  64      function &getACL() {
  65          if ($this->_instance == null) {
  66              uses('controller' . DS . 'components' . DS . ACL_FILENAME);
  67              $classname = ACL_CLASSNAME;
  68              $this->_instance = new $classname;
  69          }
  70  
  71          if($classname == 'DB_ACL') {
  72              $this->Aro = new Aro();
  73              $this->Aco = new Aco();
  74          }
  75          return $this->_instance;
  76      }
  77  /**
  78   * Empty class defintion, to be overridden in subclasses.
  79   *
  80   * @access public
  81   */
  82  	function _initACL() {
  83      }
  84  /**
  85   * Pass-thru function for ACL check instance.
  86   *
  87   * @param string $aro
  88   * @param string $aco
  89   * @param string $action : default = *
  90   * @return boolean
  91   * @access public
  92   */
  93  	function check($aro, $aco, $action = "*") {
  94          return $this->_instance->check($aro, $aco, $action);
  95      }
  96  /**
  97   * Pass-thru function for ACL allow instance.
  98   *
  99   * @param string $aro
 100   * @param string $aco
 101   * @param string $action : default = *
 102   * @return boolean
 103   * @access public
 104   */
 105  	function allow($aro, $aco, $action = "*") {
 106          return $this->_instance->allow($aro, $aco, $action);
 107      }
 108  /**
 109   * Pass-thru function for ACL deny instance.
 110   *
 111   * @param string $aro
 112   * @param string $aco
 113   * @param string $action : default = *
 114   * @return boolean
 115   * @abstract public
 116   */
 117  	function deny($aro, $aco, $action = "*") {
 118          return $this->_instance->deny($aro, $aco, $action);
 119      }
 120  /**
 121   * Pass-thru function for ACL inherit instance.
 122   *
 123   * @return boolean
 124   * @abstract public
 125   */
 126  	function inherit($aro, $aco, $action = "*") {
 127          return $this->_instance->inherit($aro, $aco, $action);
 128      }
 129  /**
 130   * Pass-thru function for ACL grant instance.
 131   *
 132   * @param string $aro
 133   * @param string $aco
 134   * @param string $action : default = *
 135   * @return boolean
 136   * @access public
 137   */
 138  	function grant($aro, $aco, $action = "*") {
 139          return $this->_instance->grant($aro, $aco, $action);
 140      }
 141  /**
 142   * Pass-thru function for ACL grant instance.
 143   *
 144   * @param string $aro
 145   * @param string $aco
 146   * @param string $action : default = *
 147   * @return boolean
 148   * @access public
 149   */
 150  	function revoke($aro, $aco, $action = "*") {
 151          return $this->_instance->revoke($aro, $aco, $action);
 152      }
 153  /**
 154   * Sets the current ARO instance to object from getAro
 155   *
 156   * @param string $id
 157   * @return boolean
 158   * @access public
 159   */
 160  	function setAro($id) {
 161          return $this->Aro = $this->_instance->getAro($id);
 162      }
 163  /**
 164  * Sets the current ACO instance to object from getAco
 165   *
 166   * @param string $id
 167   * @return boolean
 168   * @access public
 169   */
 170  	function setAco($id) {
 171          return $this->Aco = $this->_instance->getAco($id);
 172      }
 173  /**
 174   * Pass-thru function for ACL getAro instance
 175   * that gets an ARO object from the given id or alias
 176   *
 177   * @param string $id
 178   * @return object Aro
 179   * @access public
 180   */
 181  	function getAro($id) {
 182          return $this->_instance->getAro($id);
 183      }
 184  /**
 185   * Pass-thru function for ACL getAco instance.
 186   * that gets an ACO object from the given id or alias
 187   *
 188   * @param string $id
 189   * @return object Aco
 190   * @access public
 191   */
 192  	function getAco($id) {
 193          return $this->_instance->getAco($id);
 194      }
 195  }
 196  ?>


Généré le : Sun Feb 25 19:27:47 2007 par Balluche grâce à PHPXref 0.7