protected function createAclConfigFromPrivileges($controllerService, array $privileges, &$aclConfig, $denyByDefault)
    {
        // Normalize the controller service name.
        // zend-mvc will always pass the name using namespace seprators, but
        // the admin may write the name using dash seprators.
        $controllerService = strtr($controllerService, '-', '\\');
        if (isset($privileges['actions'])) {
            foreach ($privileges['actions'] as $action => $methods) {
                $action = lcfirst($action);
                $aclConfig[] = [
                    'resource'   => sprintf('%s::%s', $controllerService, $action),
                    'privileges' => $this->createPrivilegesFromMethods($methods, $denyByDefault),
                ];
            }
        }

        if (isset($privileges['collection'])) {
            $aclConfig[] = [
                'resource'   => sprintf('%s::collection', $controllerService),
                'privileges' => $this->createPrivilegesFromMethods($privileges['collection'], $denyByDefault),
            ];
        }

        if (isset($privileges['entity'])) {
            $aclConfig[] = [
                'resource'   => sprintf('%s::entity', $controllerService),
                'privileges' => $this->createPrivilegesFromMethods($privileges['entity'], $denyByDefault),
            ];
        }
    }
protected function createAclConfigFromPrivileges($controllerService, array $privileges, &$aclConfig, $denyByDefault)
    {
        // Normalize the controller service name.
        // zend-mvc will always pass the name using namespace seprators, but
        // the admin may write the name using dash seprators.
        $controllerService = strtr($controllerService, '-', '\\');
        if (isset($privileges['actions'])) {
            foreach ($privileges['actions'] as $action => $methods) {
                $action = lcfirst($action);
                $aclConfig[] = [
                    'resource'   => sprintf('%s::%s', $controllerService, $action),
                    'privileges' => $this->createPrivilegesFromMethods($methods, $denyByDefault),
                ];
            }
        }

        if (isset($privileges['collection'])) {
            $aclConfig[] = [
                'resource'   => sprintf('%s::collection', $controllerService),
                'privileges' => $this->createPrivilegesFromMethods($privileges['collection'], $denyByDefault),
            ];
        }

        if (isset($privileges['entity'])) {
            $aclConfig[] = [
                'resource'   => sprintf('%s::entity', $controllerService),
                'privileges' => $this->createPrivilegesFromMethods($privileges['entity'], $denyByDefault),
            ];
        }
    }
protected function createAclConfigFromPrivileges ( $ controllerService , array $ privileges , & $ aclConfig , $ denyByDefault ) { // Normalize the controller service name. // zend-mvc will always pass the name using namespace seprators, but // the admin may write the name using dash seprators. $ controllerService = strtr ( $ controllerService , '-' , '\\' ) ; if ( isset ( $ privileges [ 'actions' ] ) ) { foreach ( $ privileges [ 'actions' ] as $ action => $ methods ) { $ action = lcfirst ( $ action ) ; $ aclConfig [ ] = [ 'resource' => sprintf ( '%s::%s' , $ controllerService , $ action ) , 'privileges' => $ this -> createPrivilegesFromMethods ( $ methods , $ denyByDefault ) , ] ; } } if ( isset ( $ privileges [ 'collection' ] ) ) { $ aclConfig [ ] = [ 'resource' => sprintf ( '%s::collection' , $ controllerService ) , 'privileges' => $ this -> createPrivilegesFromMethods ( $ privileges [ 'collection' ] , $ denyByDefault ) , ] ; } if ( isset ( $ privileges [ 'entity' ] ) ) { $ aclConfig [ ] = [ 'resource' => sprintf ( '%s::entity' , $ controllerService ) , 'privileges' => $ this -> createPrivilegesFromMethods ( $ privileges [ 'entity' ] , $ denyByDefault ) , ] ; } }
Creates ACL configuration based on the privileges configured

- Extracts a privilege per action
- Extracts privileges for each of "collection" and "entity" configured

@param string $controllerService
@param array $privileges
@param array $aclConfig
@param bool $denyByDefault
Creates ACL configuration based on the privileges configured