Work out which attributes are available to a DN

This commit is contained in:
2023-09-02 20:28:04 +10:00
parent 9d1d969113
commit 6d900d0964
4 changed files with 87 additions and 31 deletions

View File

@@ -200,6 +200,9 @@ final class ObjectClass extends Base {
public function __get(string $key): mixed
{
switch ($key) {
case 'attributes':
return $this->getAllAttrs();
case 'sup':
return $this->sup_classes;
@@ -216,6 +219,16 @@ final class ObjectClass extends Base {
}
}
/**
* Return a list of attributes that this objectClass provides
*
* @return Collection
*/
public function getAllAttrs(): Collection
{
return $this->getMustAttrs()->merge($this->getMayAttrs());
}
/**
* Adds an objectClass to the list of objectClasses that inherit
* from this objectClass.
@@ -229,6 +242,17 @@ final class ObjectClass extends Base {
}
}
/**
* Returns the array of objectClass names which inherit from this objectClass.
*
* @return Collection Names of objectClasses which inherit from this objectClass.
* @deprecated use $this->child_objectclasses
*/
public function getChildObjectClasses(): Collection
{
return $this->child_objectclasses;
}
/**
* Behaves identically to addMustAttrs, but it operates on the MAY
* attributes of this objectClass.
@@ -397,6 +421,27 @@ final class ObjectClass extends Base {
return $result;
}
/**
* Gets the objectClass names from which this objectClass inherits.
*
* @return Collection An array of objectClass names (strings)
* @deprecated use $this->sup_classes;
*/
public function getSupClasses(): Collection
{
return $this->sup_classes;
}
/**
* Gets the type of this objectClass: STRUCTURAL, ABSTRACT, or AUXILIARY.
*
* @deprecated use $this->type_name
*/
public function getType()
{
return $this->type;
}
/**
* Determine if an array is listed in the may_force attrs
*/
@@ -492,35 +537,4 @@ final class ObjectClass extends Base {
return $i;
}
/**
* Returns the array of objectClass names which inherit from this objectClass.
*
* @return Collection Names of objectClasses which inherit from this objectClass.
* @deprecated use $this->child_objectclasses
*/
public function getChildObjectClasses(): Collection
{
return $this->child_objectclasses;
}
/**
* Gets the objectClass names from which this objectClass inherits.
*
* @return array An array of objectClass names (strings)
* @deprecated use $this->sup_classes;
*/
public function getSupClasses() {
return $this->sup_classes;
}
/**
* Gets the type of this objectClass: STRUCTURAL, ABSTRACT, or AUXILIARY.
*
* @deprecated use $this->type_name
*/
public function getType()
{
return $this->type;
}
}