예제 #1
0
 /**
  * Returns a new LDAP Entry instance.
  *
  * @param array $attributes
  *
  * @return Entry
  */
 public function newLdapEntry(array $attributes = [])
 {
     $attribute = $this->schema->objectCategory();
     if (array_key_exists($attribute, $attributes) && array_key_exists(0, $attributes[$attribute])) {
         // We'll explode the DN so we can grab it's object category.
         $category = Utilities::explodeDn($attributes[$attribute][0]);
         // Make sure the category string exists in the attribute array.
         if (array_key_exists(0, $category)) {
             $category = strtolower($category[0]);
             $mappings = $this->map();
             // Retrieve the category model mapping.
             if (array_key_exists($category, $mappings)) {
                 $model = $mappings[$category];
                 return $this->newModel([], $model)->setRawAttributes($attributes);
             }
         }
     }
     // A default entry model if the object category isn't found.
     return $this->newModel()->setRawAttributes($attributes);
 }
예제 #2
0
 /**
  * Returns a query builder limited to exchange servers.
  *
  * @return Builder
  */
 public function computers()
 {
     return $this->query->whereEquals($this->schema->objectCategory(), $this->schema->objectCategoryComputer());
 }
예제 #3
0
파일: Factory.php 프로젝트: gwjwin/Adldap2
 /**
  * Returns a query builder limited to users.
  *
  * @return Builder
  */
 public function users()
 {
     return $this->query->whereEquals($this->schema->objectClass(), $this->schema->objectClassPerson())->whereEquals($this->schema->objectCategory(), $this->schema->objectCategoryPerson());
 }