Fix validation on existing entries, missed in 88db4cc
This commit is contained in:
parent
2320445dfb
commit
c8d1122ff6
@ -10,14 +10,24 @@ class EntryRequest extends FormRequest
|
|||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
|
* @throws \Psr\Container\ContainerExceptionInterface
|
||||||
|
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
$r = request() ?: collect();
|
$r = request() ?: collect();
|
||||||
|
$rk = array_keys($r->all());
|
||||||
|
|
||||||
return config('server')
|
return config('server')
|
||||||
->schema('attributetypes')
|
->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',[])))
|
->map(fn($item)=>$item->validation($r->get('objectclass',[])))
|
||||||
->filter()
|
->filter()
|
||||||
->flatMap(fn($item)=>$item)
|
->flatMap(fn($item)=>$item)
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use LdapRecord\Configuration\DomainConfiguration;
|
use LdapRecord\Configuration\DomainConfiguration;
|
||||||
use LdapRecord\Laravel\LdapRecord;
|
use LdapRecord\Laravel\LdapRecord;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<sup data-bs-toggle="tooltip" title="@lang('Value calculated from another attribute')"><i class="fas fa-wand-magic-sparkles"></i></sup>
|
<sup data-bs-toggle="tooltip" title="@lang('Value calculated from another attribute')"><i class="fas fa-wand-magic-sparkles"></i></sup>
|
||||||
@endif
|
@endif
|
||||||
@if((! $ca) && (! $ct) && $template?->attribute($o->name_lc))
|
@if((! $ca) && (! $ct) && $template?->attribute($o->name_lc))
|
||||||
<sup data-bs-toggle="tooltip" title="@lang('Attribute controlled by template')"><i class="fas fa-wand-magic"></i></sup>
|
<sup data-bs-toggle="tooltip" title="@lang('Value controlled by template')"><i class="fas fa-wand-magic"></i></sup>
|
||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user