/** * 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()); } }
/** * 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; } }
/** * 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]; }
/** * 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); }
/** * Assembles the organization names in the distinguished name. * * @return string */ public function assembleOs() { return $this->assembleRdns($this->schema->organizationName(), $this->organizationNames); }
/** * 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()]); }