1<?php 2 3/** 4 * This file is part of the FreeDSx LDAP package. 5 * 6 * (c) Chad Sikorra <Chad.Sikorra@gmail.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12namespace FreeDSx\Ldap\Control\Ad; 13 14use FreeDSx\Asn1\Asn1; 15use FreeDSx\Asn1\Type\AbstractType; 16use FreeDSx\Ldap\Control\Control; 17 18/** 19 * Represents a SD Flags Control for Active Directory. 20 * 21 * SDFlagsRequestValue ::= SEQUENCE { 22 * Flags INTEGER 23 * } 24 * 25 * @see https://msdn.microsoft.com/en-us/library/cc223323.aspx 26 * @author Chad Sikorra <Chad.Sikorra@gmail.com> 27 */ 28class SdFlagsControl extends Control 29{ 30 /** 31 * Owner identifier of the object. 32 */ 33 public const OWNER_SECURITY_INFORMATION = 1; 34 35 /** 36 * Primary group identifier. 37 */ 38 public const GROUP_SECURITY_INFORMATION = 2; 39 40 /** 41 * Discretionary access control list (DACL) of the object. 42 */ 43 public const DACL_SECURITY_INFORMATION = 4; 44 45 /** 46 * System access control list (SACL) of the object. 47 */ 48 public const SACL_SECURITY_INFORMATION = 8; 49 50 /** 51 * @var int 52 */ 53 protected $flags; 54 55 /** 56 * @param int $flags 57 */ 58 public function __construct(int $flags) 59 { 60 $this->flags = $flags; 61 parent::__construct(self::OID_SD_FLAGS); 62 } 63 64 /** 65 * @return int 66 */ 67 public function getFlags(): int 68 { 69 return $this->flags; 70 } 71 72 /** 73 * @param int $flags 74 * @return $this 75 */ 76 public function setFlags(int $flags) 77 { 78 $this->flags = $flags; 79 80 return $this; 81 } 82 83 public function toAsn1(): AbstractType 84 { 85 $this->controlValue = Asn1::sequence(Asn1::integer($this->flags)); 86 87 return parent::toAsn1(); 88 } 89} 90