LdapTools\Security\SddlParser::parse PHP Method

parse() public method

Given a full SDDL string, parse it and return the SecurityDescriptor object that it represents.
public parse ( string $sddl ) : SecurityDescriptor
$sddl string
return SecurityDescriptor
    public function parse($sddl)
    {
        if (!preg_match(self::MATCH_SDDL, (string) $sddl, $matches)) {
            throw new SddlParserException('The SDDL string is not valid.');
        }
        $sd = (new SecurityDescriptor())->setOwner($this->getSid($matches[1], 'owner'))->setGroup($this->getSid($matches[2], 'group'));
        $this->parseAcl(strtoupper($matches[4]), $matches[5], $sd);
        if (isset($matches[7])) {
            $this->parseAcl(strtoupper($matches[7]), $matches[8], $sd);
        }
        return $sd;
    }