Esempio n. 1
0
 /**
  * Returns the root DSE record.
  *
  * @return RootDse|null
  */
 public function getRootDse()
 {
     $root = $this->query->newInstance()->setDn(null)->read(true)->whereHas($this->schema->objectClass())->first();
     if ($root instanceof Model) {
         return (new RootDse([], $this->query))->setRawAttributes($root->getAttributes());
     }
 }
Esempio n. 2
0
 /**
  * Converts the inserted string boolean to a PHP boolean.
  *
  * @param string $bool
  *
  * @return null|bool
  */
 protected function convertStringToBool($bool)
 {
     $bool = strtoupper($bool);
     if ($bool === strtoupper($this->schema->false())) {
         return false;
     } elseif ($bool === strtoupper($this->schema->true())) {
         return true;
     } else {
         return;
     }
 }
Esempio n. 3
0
 /**
  * Returns the object class model class mapping.
  *
  * @return array
  */
 public function map()
 {
     return [$this->schema->objectClassComputer() => \Adldap\Models\Computer::class, $this->schema->objectClassContact() => \Adldap\Models\Contact::class, $this->schema->objectClassPerson() => \Adldap\Models\User::class, $this->schema->objectClassGroup() => \Adldap\Models\Group::class, $this->schema->objectClassContainer() => \Adldap\Models\Container::class, $this->schema->objectClassPrinter() => \Adldap\Models\Printer::class, $this->schema->objectClassOu() => \Adldap\Models\OrganizationalUnit::class];
 }
Esempio n. 4
0
 /**
  * Finds a record by its Object SID.
  *
  * @param string       $sid
  * @param array|string $columns
  *
  * @return mixed
  */
 public function findBySid($sid, $columns = [])
 {
     return $this->findBy($this->schema->objectSid(), $sid, $columns);
 }
Esempio n. 5
0
 /**
  * Assembles the organization names in the distinguished name.
  *
  * @return string
  */
 public function assembleOs()
 {
     return $this->assembleRdns($this->schema->organizationName(), $this->organizationNames);
 }
Esempio n. 6
0
 /**
  * Creates a new computer instance.
  *
  * @param array $attributes
  *
  * @return Computer
  */
 public function computer(array $attributes = [])
 {
     return (new Computer($attributes, $this->query))->setAttribute($this->schema->objectClass(), [$this->schema->top(), $this->schema->person(), $this->schema->organizationalPerson(), $this->schema->user(), $this->schema->computer()]);
 }