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

@@ -103,6 +103,21 @@ class Entry extends Model
return Crypt::encryptString($this->getDn());
}
/**
* Return a list of available attributes - as per the objectClass entry of the record
*
* @return Collection
*/
public function getAvailableAttributes(): Collection
{
$result = collect();
foreach ($this->objectclass as $oc)
$result = $result->merge(config('server')->schema('objectclasses',$oc)->attributes);
return $result;
}
/**
* Return a list of LDAP internal attributes
*
@@ -115,6 +130,16 @@ class Entry extends Model
});
}
/**
* Return a list of attributes without any values
*
* @return Collection
*/
public function getMissingAttributes(): Collection
{
return $this->getAvailableAttributes()->diff($this->getVisibleAttributes());
}
/**
* Return this list of user attributes
*