Update AttributeTypes/LDAPSyntaxes/MatchingRules for performance and process improvements
This commit is contained in:
@@ -44,19 +44,21 @@ class HomeController extends Controller
|
||||
$o = new Entry;
|
||||
$o->setRDNBase($key['dn']);
|
||||
|
||||
foreach (collect(old())->except(['_token','key','step','rdn','rdn_value','userpassword_hash']) as $old => $value)
|
||||
$o->{$old} = array_filter($value);
|
||||
|
||||
if (count($x=collect(old('objectclass',$request->validated('objectclass')))->dot()->filter())) {
|
||||
$o->objectclass = Arr::undot($x);
|
||||
|
||||
// Also add in our required attributes
|
||||
foreach($o->getAvailableAttributes()->filter(fn($item)=>$item->required) as $ao)
|
||||
foreach ($o->getAvailableAttributes()->filter(fn($item)=>$item->is_must) as $ao)
|
||||
$o->{$ao->name} = [Entry::TAG_NOTAG=>''];
|
||||
|
||||
} elseif ($request->validated('template')) {
|
||||
$template = $o->template($request->validated('template'));
|
||||
$o->objectclass = [Entry::TAG_NOTAG=>$template->objectclasses->toArray()];
|
||||
|
||||
// @todo We need to add aliases
|
||||
foreach($o->getAvailableAttributes()->filter(fn($item)=>$template->attributes->contains($item)) as $ao)
|
||||
foreach ($o->getAvailableAttributes()->filter(fn($item)=>$item->names_lc->intersect($template->attributes)->count()) as $ao)
|
||||
$o->{$ao->name} = [Entry::TAG_NOTAG=>''];
|
||||
}
|
||||
|
||||
|
@@ -35,9 +35,18 @@ class EntryAddRequest extends FormRequest
|
||||
return [];
|
||||
|
||||
$r = request() ?: collect();
|
||||
$rk = array_keys($r->all());
|
||||
|
||||
return config('server')
|
||||
->schema('attributetypes')
|
||||
->intersectByKeys($r->all())
|
||||
->filter(fn($item)=>$item->names_lc->intersect($rk)->count())
|
||||
->transform(function($item) use ($rk) {
|
||||
// Set the attributetype name
|
||||
if (($x=$item->names_lc->intersect($rk))->count() === 1)
|
||||
$item->setName($x->pop());
|
||||
|
||||
return $item;
|
||||
})
|
||||
->map(fn($item)=>$item->validation($r->get('objectclass',[])))
|
||||
->filter()
|
||||
->flatMap(fn($item)=>$item)
|
||||
|
Reference in New Issue
Block a user