- Added attributes and also Group[C
This commit is contained in:
		
							parent
							
								
									bced56ba77
								
							
						
					
					
						commit
						7a06f5fd64
					
				
							
								
								
									
										16
									
								
								src/Attribute/Obj/ObjectClass.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/Attribute/Obj/ObjectClass.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace Ulmus\Ldap\Attribute\Obj; | ||||
| 
 | ||||
| #[\Attribute]
 | ||||
| class ObjectClass { | ||||
| 
 | ||||
|     public string $type; | ||||
| 
 | ||||
|     public function __construct($type = null) | ||||
|     { | ||||
|         if ( $type !== null ) { | ||||
|             $this->type = $type; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										16
									
								
								src/Attribute/Obj/ObjectType.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/Attribute/Obj/ObjectType.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace Ulmus\Ldap\Attribute\Obj; | ||||
| 
 | ||||
| #[\Attribute]
 | ||||
| class ObjectType { | ||||
| 
 | ||||
|     public string $type; | ||||
| 
 | ||||
|     public function __construct($type = null) | ||||
|     { | ||||
|         if ( $type !== null ) { | ||||
|             $this->type = $type; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -82,7 +82,7 @@ class LdapObject { | ||||
|     { | ||||
|         static::$dump && call_user_func_array(static::$dump, [ $filter, $fields ]); | ||||
| 
 | ||||
|         $this->search = ldap_search($this->connection, $this->dn, $filter['filters'], $filter['fields'], 0, 0); | ||||
|         $this->search = ldap_search($this->connection, $this->dn, $filter['filters'], $filter['fields'] ?? [], 0, 0); | ||||
| 
 | ||||
|         $this->rowCount = $this->bufferedRows = ldap_count_entries($this->connection, $this->search); | ||||
| 
 | ||||
| @ -177,7 +177,7 @@ class LdapObject { | ||||
|     public function runUpdateQuery(array $filter, array $dataset) | ||||
|     { | ||||
|         static::$dump && call_user_func_array(static::$dump, [ $filter, $dataset ]); | ||||
|          | ||||
|         dump($filter, $dataset); | ||||
|         if ( false === ( $queryResult = ldap_mod_replace($this->connection, $filter['dn'], $dataset) ) ) { | ||||
|             $this->throwLdapException(); | ||||
|         } | ||||
|  | ||||
| @ -4,50 +4,36 @@ namespace Ulmus\Ldap\Entity; | ||||
| 
 | ||||
| use Ulmus\Ldap\Entity\Field\{ Datetime }; | ||||
| 
 | ||||
| /** | ||||
|  * @ObjectClass('computer') | ||||
|  */ | ||||
| use Ulmus\Attribute\Property\Field; | ||||
| 
 | ||||
| use Ulmus\Ldap\Attribute\Obj\ObjectClass; | ||||
| 
 | ||||
| #[ObjectClass("computer")]
 | ||||
| class Computer | ||||
| { | ||||
|     use \Ulmus\Ldap\EntityTrait; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $samaccountname; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $name; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $description; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field('DNSHostName') | ||||
|      */ | ||||
|     #[Field("DNSHostName")]
 | ||||
|     public string $hostname; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $location; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $operatingSystem; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $operatingSystemServicePack; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $operatingSystemVersion; | ||||
| } | ||||
							
								
								
									
										35
									
								
								src/Entity/Group.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								src/Entity/Group.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,35 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace Ulmus\Ldap\Entity; | ||||
| 
 | ||||
| use Ulmus\Ldap\Entity\Field\{ Datetime }; | ||||
| 
 | ||||
| use Ulmus\Attribute\Property\Field; | ||||
| 
 | ||||
| use Ulmus\Ldap\Attribute\Obj\ObjectClass; | ||||
| 
 | ||||
| #[ObjectClass("group")]
 | ||||
| class Group | ||||
| { | ||||
|     use \Ulmus\Ldap\EntityTrait; | ||||
| 
 | ||||
|     #[Field]
 | ||||
|     public string $samaccountname; | ||||
| 
 | ||||
|     #[Field]
 | ||||
|     public array $members; | ||||
| 
 | ||||
|     #[Field]
 | ||||
|     public string $name; | ||||
| 
 | ||||
|     #[Field]
 | ||||
|     public string $canonicalName; | ||||
| 
 | ||||
|     #[Field(name: "objectGUID")]
 | ||||
|     public string $guid; | ||||
| 
 | ||||
|     public function __toString() : string | ||||
|     { | ||||
|         return $this->name; | ||||
|     } | ||||
| } | ||||
| @ -4,51 +4,37 @@ namespace Ulmus\Ldap\Entity; | ||||
| 
 | ||||
| use Ulmus\Ldap\Entity\Field\{ Datetime }; | ||||
| 
 | ||||
| /** | ||||
|  * @ObjectClass('organizationalUnit') | ||||
|  */ | ||||
| use Ulmus\Attribute\Property\Field; | ||||
| 
 | ||||
| use Ulmus\Ldap\Attribute\Obj\ObjectClass; | ||||
| 
 | ||||
| #[ObjectClass("organizationalUnit")]
 | ||||
| class OrganizationalUnit | ||||
| { | ||||
|     use \Ulmus\Ldap\EntityTrait; | ||||
| 
 | ||||
|     /** | ||||
|      * @Id | ||||
|      */ | ||||
|     #[Field\Id]
 | ||||
|     public string $ou; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $description; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field('name' => "st") | ||||
|      */ | ||||
|     #[Field(name: "st")]
 | ||||
|     public string $state; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field('name' => 'physicalDeliveryOfficeName') | ||||
|      */ | ||||
|     #[Field(name: "physicalDeliveryOfficeName")]
 | ||||
|     public string $officeName; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field('name' => 'postalAddress') | ||||
|      */ | ||||
|     #[Field(name: "postalAddress")]
 | ||||
|     public string $address; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $postalCode; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $telephoneNumber; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field('name' => 'objectGUID') | ||||
|      */ | ||||
|     #[Field(name: "objectGUID")]
 | ||||
|     public string $guid; | ||||
| 
 | ||||
|     public function __toString() : string | ||||
|  | ||||
| @ -4,223 +4,135 @@ namespace Ulmus\Ldap\Entity; | ||||
| 
 | ||||
| use Ulmus\Ldap\Entity\Field\{ Datetime, LdapDatetime }; | ||||
| 
 | ||||
| /** | ||||
|  * @ObjectClass('user') | ||||
|  */ | ||||
| use Ulmus\Attribute\Property\{Field, Relation\Ignore, Virtual}; | ||||
| 
 | ||||
| use Ulmus\Ldap\Attribute\Obj\ObjectClass; | ||||
| 
 | ||||
| #[ObjectClass("user")]
 | ||||
| class User | ||||
| { | ||||
|     use \Ulmus\Ldap\EntityTrait; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $samaccountname; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $mail; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $mailNickname; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field('name' => 'givenname') | ||||
|      */ | ||||
|     #[Field(name: "givenname")]
 | ||||
|     public string $firstname; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field('name' => 'sn') | ||||
|      */ | ||||
|     #[Field(name: "sn")]
 | ||||
|     public string $lastname; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $displayName; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $name; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $canonicalName; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $userPrincipalName; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $description; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field('name' => "st") | ||||
|      */ | ||||
|     #[Field(name: "st")]
 | ||||
|     public string $state; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field('name' => 'physicalDeliveryOfficeName') | ||||
|      */ | ||||
|     #[Field(name: "physicalDeliveryOfficeName")]
 | ||||
|     public string $officeName; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $company; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $department; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $telephoneNumber; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $title; | ||||
| 
 | ||||
|     /** | ||||
|      * @Virtual | ||||
|      */ | ||||
|     ##[Virtual]
 | ||||
|     # public ? array $memberOf;
 | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public int $userAccountControl; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute1; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute2; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute3; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute4; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute5; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute6; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute7; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute8; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute9; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute10; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute11; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute12; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute13; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute14; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $extensionAttribute15; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public int $logonCount; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field('name' => 'unicodePwd') | ||||
|      */ | ||||
|     #[Field(name: "unicodePwd")]
 | ||||
|     public string $unicodePassword; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $userPassword; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $scriptPath; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $sid; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field | ||||
|      */ | ||||
|     #[Field]
 | ||||
|     public string $targetAddress; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field('name' => "lastLogon", 'readonly' => true) | ||||
|      */ | ||||
|     #[Field(name: "lastLogon", readonly: true)]
 | ||||
|     public LdapDatetime $lastLogon; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field('name' => "whenChanged", 'readonly' => true) | ||||
|      * / | ||||
|     public LdapDatetime $updatedAt; | ||||
| 
 | ||||
|     /** | ||||
|      * @Field('name' => "whenCreated", 'readonly' => true) | ||||
|      * / | ||||
|     public LdapDatetime $createdAt; */ | ||||
| 
 | ||||
|   | ||||
|     public function __toString() : string | ||||
|     { | ||||
|         return implode(' ', array_filter([ $this->firstname ?? "", $this->lastname ?? "" ])) ?: ( $this->displayName ?? "" ); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user