public static function factory(array $config)
    {
        // Determine whether we are whitelisting or blacklisting
        $denyByDefault = false;
        if (array_key_exists('deny_by_default', $config)) {
            $denyByDefault = (bool)$config['deny_by_default'];
            unset($config['deny_by_default']);
        }

        // By default, create an open ACL
        $acl = new AclAuthorization;
        $acl->addRole('guest');
        $acl->allow();

        $grant = 'deny';
        if ($denyByDefault) {
            $acl->deny('guest', null, null);
            $grant = 'allow';
        }

        if (! empty($config)) {
            return self::injectGrants($acl, $grant, $config);
        }

        return $acl;
    }
public static function factory(array $config)
    {
        // Determine whether we are whitelisting or blacklisting
        $denyByDefault = false;
        if (array_key_exists('deny_by_default', $config)) {
            $denyByDefault = (bool)$config['deny_by_default'];
            unset($config['deny_by_default']);
        }

        // By default, create an open ACL
        $acl = new AclAuthorization;
        $acl->addRole('guest');
        $acl->allow();

        $grant = 'deny';
        if ($denyByDefault) {
            $acl->deny('guest', null, null);
            $grant = 'allow';
        }

        if (! empty($config)) {
            return self::injectGrants($acl, $grant, $config);
        }

        return $acl;
    }
public static function factory ( array $ config ) { // Determine whether we are whitelisting or blacklisting $ denyByDefault = false ; if ( array_key_exists ( 'deny_by_default' , $ config ) ) { $ denyByDefault = ( bool ) $ config [ 'deny_by_default' ] ; unset ( $ config [ 'deny_by_default' ] ) ; } // By default, create an open ACL $ acl = new AclAuthorization ; $ acl -> addRole ( 'guest' ) ; $ acl -> allow ( ) ; $ grant = 'deny' ; if ( $ denyByDefault ) { $ acl -> deny ( 'guest' , null , null ) ; $ grant = 'allow' ; } if ( ! empty ( $ config ) ) { return self :: injectGrants ( $ acl , $ grant , $ config ) ; } return $ acl ; }
Create and return an AclAuthorization instance populated with provided privileges.

@param array $config
@return AclAuthorization
Create and return an AclAuthorization instance populated with provided privileges .