library/Garp/Application/Resource/Acl.php
protected function _addRules($type, array $rules, $resource, $resourceName) {
        if (!$type) {
            $type = Zend_Acl::TYPE_ALLOW;
        }
        foreach ($rules as $privilege => $ruleProperties) {
            // If the user sets the privilege value to a string, we will consider
            // this as the list of roles.
            if (!is_array($ruleProperties)) {
                $ruleProperties = array('roles' => $ruleProperties);
            }

            if ($privilege === 'all') {
                $privilege = null;
            }

            $roles = $ruleProperties['roles'];

            if (is_null($roles) || empty($roles)) {
                $section = 'rules';
                if ($type === Zend_Acl::TYPE_ALLOW) {
                    $section = 'allow ' . $section;
                } else {
                    $section = 'deny ' . $section;
                }

                throw new Zend_Application_Resource_Exception(
                    sprintf(
                        $this->_missingPropertyMessage,
                        'roles',
                        $section,
                        'resource ' . $resourceName
                    )
                );
            }

            $roles = explode(',', $roles);

            if ($roles[0] === 'all') {
                $roles = null;
            }

            $assert = null;

            if (isset($ruleProperties['assert']) && !empty($ruleProperties['assert'])) {
                $assert = $ruleProperties['assert'];
                $assert = new $assert();
            }

            $this->_acl->setRule(
                Zend_Acl::OP_ADD,
                $type,
                $roles,
                $resource,
                $privilege,
                $assert
            );
        }
    }
protected function _addRules($type, array $rules, $resource, $resourceName) {
        if (!$type) {
            $type = Zend_Acl::TYPE_ALLOW;
        }
        foreach ($rules as $privilege => $ruleProperties) {
            // If the user sets the privilege value to a string, we will consider
            // this as the list of roles.
            if (!is_array($ruleProperties)) {
                $ruleProperties = array('roles' => $ruleProperties);
            }

            if ($privilege === 'all') {
                $privilege = null;
            }

            $roles = $ruleProperties['roles'];

            if (is_null($roles) || empty($roles)) {
                $section = 'rules';
                if ($type === Zend_Acl::TYPE_ALLOW) {
                    $section = 'allow ' . $section;
                } else {
                    $section = 'deny ' . $section;
                }

                throw new Zend_Application_Resource_Exception(
                    sprintf(
                        $this->_missingPropertyMessage,
                        'roles',
                        $section,
                        'resource ' . $resourceName
                    )
                );
            }

            $roles = explode(',', $roles);

            if ($roles[0] === 'all') {
                $roles = null;
            }

            $assert = null;

            if (isset($ruleProperties['assert']) && !empty($ruleProperties['assert'])) {
                $assert = $ruleProperties['assert'];
                $assert = new $assert();
            }

            $this->_acl->setRule(
                Zend_Acl::OP_ADD,
                $type,
                $roles,
                $resource,
                $privilege,
                $assert
            );
        }
    }
protected function _addRules ( $ type , array $ rules , $ resource , $ resourceName ) { if ( ! $ type ) { $ type = Zend_Acl :: TYPE_ALLOW ; } foreach ( $ rules as $ privilege => $ ruleProperties ) { // If the user sets the privilege value to a string, we will consider // this as the list of roles. if ( ! is_array ( $ ruleProperties ) ) { $ ruleProperties = array ( 'roles' => $ ruleProperties ) ; } if ( $ privilege === 'all' ) { $ privilege = null ; } $ roles = $ ruleProperties [ 'roles' ] ; if ( is_null ( $ roles ) || empty ( $ roles ) ) { $ section = 'rules' ; if ( $ type === Zend_Acl :: TYPE_ALLOW ) { $ section = 'allow ' . $ section ; } else { $ section = 'deny ' . $ section ; } throw new Zend_Application_Resource_Exception ( sprintf ( $ this -> _missingPropertyMessage , 'roles' , $ section , 'resource ' . $ resourceName ) ) ; } $ roles = explode ( ',' , $ roles ) ; if ( $ roles [ 0 ] === 'all' ) { $ roles = null ; } $ assert = null ; if ( isset ( $ ruleProperties [ 'assert' ] ) && ! empty ( $ ruleProperties [ 'assert' ] ) ) { $ assert = $ ruleProperties [ 'assert' ] ; $ assert = new $ assert ( ) ; } $ this -> _acl -> setRule ( Zend_Acl :: OP_ADD , $ type , $ roles , $ resource , $ privilege , $ assert ) ; } }
Method used to add rules to the specified resource.

@param string $type
@param array $rules
@param string $resource
@param string $resourceName
@return void
Method used to add rules to the specified resource .