src/acdhOeaw/fedora/acl/WebAclRule.php
protected function loadMetadata(bool $force = false) {
        $metaEmpty = $this->metadata == null;
        parent::loadMetadata($force);

        if ($metaEmpty || $force) {
            foreach ($this->metadata->allResources('http://www.w3.org/ns/auth/acl#mode') as $i) {
                $mode = preg_replace('#^.*(Read|Write)$#', '\\1', $i->getUri());
                $dict = array('Read' => self::READ, 'Write' => self::WRITE);
                if (!isset($dict[$mode])) {
                    throw new AclException('wrong mode: ' . $mode);
                }
                $this->mode = max(array($this->mode, $dict[$mode]));
            }
            foreach ($this->metadata->allResources('http://www.w3.org/ns/auth/acl#accessTo') as $i) {
                $uri                   = $this->fedora->standardizeUri($i->getUri());
                $this->resources[$uri] = $this->fedora->getResourceByUri($uri);
            }
            foreach ($this->metadata->allResources('http://www.w3.org/ns/auth/acl#accessToClass') as $i) {
                $this->classes[$i->getUri()] = $i->getUri();
            }
            foreach ($this->metadata->all('http://www.w3.org/ns/auth/acl#agent') as $i) {
                $i                           = (string) $i;
                $this->roles[self::USER][$i] = $i;
            }
            foreach ($this->metadata->all('http://www.w3.org/ns/auth/acl#agentClass') as $i) {
                $i                            = (string) $i;
                $this->roles[self::GROUP][$i] = $i;
            }
        }
    }
protected function loadMetadata(bool $force = false) {
        $metaEmpty = $this->metadata == null;
        parent::loadMetadata($force);

        if ($metaEmpty || $force) {
            foreach ($this->metadata->allResources('http://www.w3.org/ns/auth/acl#mode') as $i) {
                $mode = preg_replace('#^.*(Read|Write)$#', '\\1', $i->getUri());
                $dict = array('Read' => self::READ, 'Write' => self::WRITE);
                if (!isset($dict[$mode])) {
                    throw new AclException('wrong mode: ' . $mode);
                }
                $this->mode = max(array($this->mode, $dict[$mode]));
            }
            foreach ($this->metadata->allResources('http://www.w3.org/ns/auth/acl#accessTo') as $i) {
                $uri                   = $this->fedora->standardizeUri($i->getUri());
                $this->resources[$uri] = $this->fedora->getResourceByUri($uri);
            }
            foreach ($this->metadata->allResources('http://www.w3.org/ns/auth/acl#accessToClass') as $i) {
                $this->classes[$i->getUri()] = $i->getUri();
            }
            foreach ($this->metadata->all('http://www.w3.org/ns/auth/acl#agent') as $i) {
                $i                           = (string) $i;
                $this->roles[self::USER][$i] = $i;
            }
            foreach ($this->metadata->all('http://www.w3.org/ns/auth/acl#agentClass') as $i) {
                $i                            = (string) $i;
                $this->roles[self::GROUP][$i] = $i;
            }
        }
    }
protected function loadMetadata ( bool $ force = false ) { $ metaEmpty = $ this -> metadata == null ; parent :: loadMetadata ( $ force ) ; if ( $ metaEmpty || $ force ) { foreach ( $ this -> metadata -> allResources ( 'http://www.w3.org/ns/auth/acl#mode' ) as $ i ) { $ mode = preg_replace ( '#^.*(Read|Write)$#' , '\\1' , $ i -> getUri ( ) ) ; $ dict = array ( 'Read' => self :: READ , 'Write' => self :: WRITE ) ; if ( ! isset ( $ dict [ $ mode ] ) ) { throw new AclException ( 'wrong mode: ' . $ mode ) ; } $ this -> mode = max ( array ( $ this -> mode , $ dict [ $ mode ] ) ) ; } foreach ( $ this -> metadata -> allResources ( 'http://www.w3.org/ns/auth/acl#accessTo' ) as $ i ) { $ uri = $ this -> fedora -> standardizeUri ( $ i -> getUri ( ) ) ; $ this -> resources [ $ uri ] = $ this -> fedora -> getResourceByUri ( $ uri ) ; } foreach ( $ this -> metadata -> allResources ( 'http://www.w3.org/ns/auth/acl#accessToClass' ) as $ i ) { $ this -> classes [ $ i -> getUri ( ) ] = $ i -> getUri ( ) ; } foreach ( $ this -> metadata -> all ( 'http://www.w3.org/ns/auth/acl#agent' ) as $ i ) { $ i = ( string ) $ i ; $ this -> roles [ self :: USER ] [ $ i ] = $ i ; } foreach ( $ this -> metadata -> all ( 'http://www.w3.org/ns/auth/acl#agentClass' ) as $ i ) { $ i = ( string ) $ i ; $ this -> roles [ self :: GROUP ] [ $ i ] = $ i ; } } }
Loads current metadata from the Fedora and parses read ACL triples.

@param bool $force enforce fetch from Fedora
(when you want to make sure metadata are in line with ones in the Fedora
or e.g. reset them back to their current state in Fedora)
@throws AclException
Loads current metadata from the Fedora and parses read ACL triples .