diff --git a/app/Http/Controllers/FederationController.php b/app/Http/Controllers/FederationController.php index 7ac7186..92af6e7 100644 --- a/app/Http/Controllers/FederationController.php +++ b/app/Http/Controllers/FederationController.php @@ -70,12 +70,14 @@ public function store(StoreFederation $request) { $this->authorize('create', Federation::class); + $validated = $request->validated(); $id = generateFederationID($validated['name']); + + + $federation = DB::transaction(function () use ($validated, $id) { $federation = Federation::create(array_merge($validated, [ - 'tagfile' => "$id.tag", - 'cfgfile' => "$id.cfg", 'xml_id' => $id, 'xml_name' => "urn:mace:cesnet.cz:$id", 'filters' => $id, @@ -164,9 +166,23 @@ public function update(UpdateFederation $request, Federation $federation) ->with('status', __('federations.approved', ['name' => $federation->name])); case 'update': + + $this->authorize('update', $federation); $validated = $request->validated(); + $id = generateFederationID($validated['name']); + + $additionalFilters = $request->input('sp_and_ip_feed', 0); + $filters = $id; + + if($additionalFilters){ + $filters .= ', '.$id.'+idp'; + $filters .= ', '.$id.'+sp'; + } + $validated['filters'] = $filters; + $validated['additional_filters'] = $additionalFilters; + $federation->update($validated); if (! $federation->wasChanged()) { diff --git a/lang/cs/common.php b/lang/cs/common.php index 662f5e1..9a12b89 100644 --- a/lang/cs/common.php +++ b/lang/cs/common.php @@ -130,4 +130,5 @@ 'metadata' => 'Metadata', 'confirm' => 'Potvrdit', 'organization' => 'Organizace', + 'add_sp_idp' => 'Přidat IdP a Sp feedy', ]; diff --git a/lang/cs/federations.php b/lang/cs/federations.php index dbf980f..77055c0 100644 --- a/lang/cs/federations.php +++ b/lang/cs/federations.php @@ -44,4 +44,5 @@ 'updated' => 'Federace byla úspěšně upravena.', 'xml_id' => 'Atribut XML ID', 'xml_name' => 'Atribut XML Name', + 'add_sp_and_idp' => 'Přidat SP & IDP', ]; diff --git a/lang/en/common.php b/lang/en/common.php index 5cdc2e2..a115056 100644 --- a/lang/en/common.php +++ b/lang/en/common.php @@ -130,4 +130,5 @@ 'metadata' => 'Metadata', 'confirm' => 'Confirm', 'organization' => 'Organization', + 'add_sp_idp' => 'Add additional IdP and Sp feeds', ]; diff --git a/lang/en/federations.php b/lang/en/federations.php index ca9a974..96358f8 100644 --- a/lang/en/federations.php +++ b/lang/en/federations.php @@ -44,4 +44,5 @@ 'updated' => 'Federation has been successfully updated.', 'xml_id' => 'XML ID attribute', 'xml_name' => 'XML Name attribute', + 'add_sp_and_idp' => 'Add SP & IDP', ]; diff --git a/resources/views/federations/create.blade.php b/resources/views/federations/create.blade.php index 9e33533..e48e482 100644 --- a/resources/views/federations/create.blade.php +++ b/resources/views/federations/create.blade.php @@ -20,6 +20,7 @@ + + + +{{-- + + + + + +--}} + + @endsection diff --git a/resources/views/federations/edit.blade.php b/resources/views/federations/edit.blade.php index 2e05b41..f3c3272 100644 --- a/resources/views/federations/edit.blade.php +++ b/resources/views/federations/edit.blade.php @@ -60,15 +60,17 @@ - - type="text" name="filters" id="filters" maxlength="32" - placeholder="{{ __('federations.name_placeholder') }}" - value="{{ $federation->filters }}" required - + @endsection diff --git a/resources/views/federations/show.blade.php b/resources/views/federations/show.blade.php index ea545e0..6b122a4 100644 --- a/resources/views/federations/show.blade.php +++ b/resources/views/federations/show.blade.php @@ -67,6 +67,9 @@ @section('admin_section') + + + {{ __('federations.tagfile') }} @@ -91,16 +94,24 @@ + - {{ __('federations.filters') }} + {{ __('common.add_sp_idp') }} - {{ $federation->filters }} + + + @endsection @section('specific_condition')