When rendering dynamic attributes, dont make them editable. Closes #10 and #89.

Also some minor fixes when returning from a post for a DN with attribute tags.
This commit is contained in:
2025-04-07 22:33:15 +10:00
parent c4d28c8a23
commit 1bf8830887
16 changed files with 63 additions and 26 deletions

View File

@@ -486,6 +486,28 @@ final class AttributeType extends Base {
return $this->used_in_object_classes;
}
/**
* For a list of objectclasses return all parent objectclasses as well
*
* @param Collection $ocs
* @return Collection
*/
public function heirachy(Collection $ocs): Collection
{
$result = collect();
foreach ($ocs as $oc) {
$schema = config('server')
->schema('objectclasses',$oc)
->getParents(TRUE)
->pluck('name');
$result = $result->merge($schema)->push($oc);
}
return $result;
}
/**
* @return bool
* @deprecated use $this->forced_as_may
@@ -555,15 +577,9 @@ final class AttributeType extends Base {
public function validation(array $array): ?array
{
// For each item in array, we need to get the OC hierarchy
$heirachy = collect($array)
$heirachy = $this->heirachy(collect($array)
->flatten()
->filter()
->map(fn($item)=>config('server')
->schema('objectclasses',$item)
->getSupClasses()
->push($item))
->flatten()
->unique();
->filter());
// Get any config validation
$validation = collect(Arr::get(config('ldap.validation'),$this->name_lc,[]));