- Added a new ObjectType annotation.
- Computer entity added - Fixed some problem related to filter and repository of LDAP specific methods.
This commit is contained in:
parent
1b11917bf5
commit
a0363ebb71
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Ulmus\Ldap\Annotation\Classes;
|
||||
|
||||
class ObjectType implements \Ulmus\Annotation\Annotation {
|
||||
|
||||
public string $type;
|
||||
|
||||
public function __construct($type = null)
|
||||
{
|
||||
if ( $type !== null ) {
|
||||
$this->type = $type;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,53 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Ulmus\Ldap\Entity;
|
||||
|
||||
use Ulmus\Ldap\Entity\Field\{ Datetime };
|
||||
|
||||
/**
|
||||
* @ObjectClass('computer')
|
||||
*/
|
||||
class Computer
|
||||
{
|
||||
use \Ulmus\Ldap\EntityTrait;
|
||||
|
||||
/**
|
||||
* @Field
|
||||
*/
|
||||
public string $samaccountname;
|
||||
|
||||
/**
|
||||
* @Field
|
||||
*/
|
||||
public string $name;
|
||||
|
||||
/**
|
||||
* @Field
|
||||
*/
|
||||
public string $description;
|
||||
|
||||
/**
|
||||
* @Field('DNSHostName')
|
||||
*/
|
||||
public string $hostname;
|
||||
|
||||
/**
|
||||
* @Field
|
||||
*/
|
||||
public string $location;
|
||||
|
||||
/**
|
||||
* @Field
|
||||
*/
|
||||
public string $operatingSystem;
|
||||
|
||||
/**
|
||||
* @Field
|
||||
*/
|
||||
public string $operatingSystemServicePack;
|
||||
|
||||
/**
|
||||
* @Field
|
||||
*/
|
||||
public string $operatingSystemVersion;
|
||||
}
|
|
@ -4,7 +4,7 @@ namespace Ulmus\Ldap;
|
|||
|
||||
use Ulmus\{ Ulmus, EventTrait, Query, Common\EntityResolver, Common\EntityField };
|
||||
|
||||
use Ulmus\Ldap\Annotation\Classes\{ ObjectClass, };
|
||||
use Ulmus\Ldap\Annotation\Classes\{ ObjectClass, ObjectType, };
|
||||
|
||||
trait EntityTrait {
|
||||
use \Ulmus\EntityTrait;
|
||||
|
|
|
@ -96,7 +96,7 @@ class Filter extends Fragment {
|
|||
$return = $this->content ?: $this->content = implode("", array_filter([
|
||||
$this->field,
|
||||
$this->operator(),
|
||||
$this->operator === Filter::OPERATOR_LIKE ? "*{$this->value}*" : $value,
|
||||
$this->operator === Filter::OPERATOR_LIKE ? str_replace('%', '*', $this->value) : $value,
|
||||
]));
|
||||
|
||||
return $this->applyOperator($return, "");
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Ulmus\Ldap;
|
||||
|
||||
use Ulmus\Ldap\Annotation\Classes\ObjectClass;
|
||||
use Ulmus\Ldap\Annotation\Classes\{ ObjectClass, ObjectType };
|
||||
use Ulmus\{EntityCollection, Ulmus, SearchRequest, Query};
|
||||
use Ulmus\Annotation\Property\{ Where, Having, Relation, Join, WithJoin, Relation\Ignore as RelationIgnore };
|
||||
use Ulmus\Common\EntityResolver;
|
||||
|
@ -27,10 +27,14 @@ class Repository extends \Ulmus\Repository
|
|||
$this->select(array_keys($this->entityResolver->fieldList(EntityResolver::KEY_COLUMN_NAME)));
|
||||
}
|
||||
|
||||
if ( null !== $objectClass = $this->entityResolver->getAnnotationFromClassname( ObjectClass::class ) ) {
|
||||
if ( null !== $objectClass = $this->entityResolver->getAnnotationFromClassname( ObjectClass::class, false ) ) {
|
||||
$this->where('objectclass', $objectClass->type);
|
||||
}
|
||||
|
||||
if ( null !== $objectClass = $this->entityResolver->getAnnotationFromClassname( ObjectType::class, false ) ) {
|
||||
$this->where('objecttype', $objectClass->type);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue