예제 #1
0
 /**
  * Add unique ARO to registry
  *
  * @param Zend_Acl_Aro $aro
  * @return Zend_Acl_Aro_Registry for fluent interface
  */
 public function add($aro, $inherit = null)
 {
     if (!$aro instanceof Zend_Acl_Aro) {
         $aro = new Zend_Acl_Aro($this, $aro, $inherit);
     }
     if (array_key_exists($aro->getId(), $this->_aro)) {
         throw new Zend_Acl_Exception('aro ' . $aro->getId() . ' already registered');
     }
     $this->_aro[$aro->getId()] = $aro;
     return $this;
 }
예제 #2
0
 /**
  * Returns a score factor for the selected Aro
  *
  * Ensures that a specific permission context is assigned a higher score
  * than an inherited permission
  *
  * @return integer
  */
 protected function _getFactor(Zend_Acl_Aro $aro, $id)
 {
     if ($aro->getId() == $id) {
         return 3;
     } elseif ($id != Zend_Acl::ARO_DEFAULT) {
         return 2;
     }
     return 1;
 }