/** * Get the SDDL string format that represents this Security Descriptor and everything it contains. * * @param bool $canonicalize Whether or not to canonicalize the DACL * @return string */ public function toSddl($canonicalize = true) { // These will always be present in the SDDL... $sddl = 'O:' . ($this->owner->getShortName() ?: $this->owner) . 'G:' . ($this->group->getShortName() ?: $this->group); foreach ([$this->dacl, $this->sacl] as $acl) { // It should be omitted if empty or not set... if ($acl && count($acl->getAces()) > 0) { $sddl .= $acl->getSddlIdentifier() . ':' . $this->getAclSddlFlags($acl); $sddl .= $acl instanceof Dacl ? $acl->toSddl($canonicalize) : $acl->toSddl(); } } return $sddl; }