Add objects directly to Entry::class when rendering a template. Fix objectclasses and attributes processing for templates

This commit is contained in:
2025-06-16 23:04:07 +10:00
parent 88db4ccc99
commit 98a0b87afe
6 changed files with 49 additions and 11 deletions

View File

@@ -58,8 +58,13 @@ class HomeController extends Controller
$template = $o->template($request->validated('template'));
$o->objectclass = [Entry::TAG_NOTAG=>$template->objectclasses->toArray()];
foreach ($o->getAvailableAttributes()->filter(fn($item)=>$item->names_lc->intersect($template->attributes)->count()) as $ao)
$o->{$ao->name} = [Entry::TAG_NOTAG=>''];
foreach ($o->getAvailableAttributes()
->filter(fn($item)=>$item->names_lc->intersect($template->attributes->map('strtolower'))->count())
->sortBy(fn($item)=>Arr::get($template->order,$item->name)) as $ao)
{
$o->addObjectItem($ao->name,
Factory::create(dn: '',attribute: $ao->name,values: [Entry::TAG_NOTAG=>''],oc: $o->objectclass));
}
}
$step = $request->step ? $request->step+1 : old('step');