LdapTools\Security\SddlParser::parseAcl PHP Method

parseAcl() protected method

protected parseAcl ( string $aclType, string $aclString, SecurityDescriptor $sd )
$aclType string
$aclString string
$sd SecurityDescriptor
    protected function parseAcl($aclType, $aclString, SecurityDescriptor $sd)
    {
        $acl = $aclType === 'D' ? new Dacl() : new Sacl();
        if (preg_match('/^([A-Za-z]+)\\(/', $aclString, $ctrlFlags)) {
            $this->parseControlFlags($ctrlFlags[1], $aclType, $sd);
        }
        preg_match_all("/\\((.*?[^\\)])\\)/", $aclString, $aces);
        foreach ($aces[1] as $ace) {
            if (!preg_match(self::MATCH_ACE, $ace)) {
                throw new SddlParserException(sprintf('The ACE with value "%s" is not valid.', $ace));
            }
            $acl->addAce($this->parseAce($ace));
        }
        if ($acl instanceof Dacl && $sd->getDacl() || $acl instanceof Sacl && $sd->getSacl()) {
            throw new SddlParserException(sprintf('The %sACL cannot be set more than once in the SDDL string.', $aclType));
        }
        if ($acl instanceof Dacl) {
            $sd->setDacl($acl);
        } else {
            $sd->setSacl($acl);
        }
    }