diff --git a/app/Http/Controllers/EntityController.php b/app/Http/Controllers/EntityController.php index f89a5d8..f3202a0 100644 --- a/app/Http/Controllers/EntityController.php +++ b/app/Http/Controllers/EntityController.php @@ -7,7 +7,6 @@ use App\Jobs\GitAddToHfd; use App\Jobs\GitDeleteFromCategory; use App\Jobs\GitDeleteFromHfd; -use App\Jobs\GitDeleteFromRs; use App\Ldap\CesnetOrganization; use App\Ldap\EduidczOrganization; use App\Mail\NewIdentityProvider; @@ -16,9 +15,7 @@ use App\Models\Federation; use App\Models\User; use App\Notifications\EntityAddedToHfd; -use App\Notifications\EntityAddedToRs; use App\Notifications\EntityDeletedFromHfd; -use App\Notifications\EntityDeletedFromRs; use App\Notifications\EntityDestroyed; use App\Notifications\EntityRequested; use App\Notifications\EntityUpdated; @@ -296,43 +293,6 @@ function () use ($entity) { break; - case 'rs': - $this->authorize('do-everything'); - - if ($entity->type->value !== 'sp') { - return redirect() - ->back() - ->with('status', __('categories.rs_controlled_for_sps_only')); - } - - $entity = DB::transaction(function () use ($entity) { - $entity->rs = $entity->rs ? false : true; - $entity->update(); - - return $entity; - }); - - $status = $entity->rs ? 'rs' : 'no_rs'; - $color = $entity->rs ? 'green' : 'red'; - - // TODO notification (not ready ask about this) - /* if ($entity->rs) { - GitAddToRs::dispatch($entity, Auth::user()); - Notification::send($entity->operators, new EntityAddedToRs($entity)); - Notification::send(User::activeAdmins()->select('id', 'email')->get(), new EntityAddedToRs($entity)); - } else { - GitDeleteFromRs::dispatch($entity, Auth::user()); - Notification::send($entity->operators, new EntityDeletedFromRs($entity)); - Notification::send(User::activeAdmins()->select('id', 'email')->get(), new EntityDeletedFromRs($entity)); - }*/ - - return redirect() - ->back() - ->with('status', __("entities.$status")) - ->with('color', $color); - - break; - case 'category': $this->authorize('do-everything'); diff --git a/app/Http/Controllers/EntityRsController.php b/app/Http/Controllers/EntityRsController.php index 1f5a5ef..4340327 100644 --- a/app/Http/Controllers/EntityRsController.php +++ b/app/Http/Controllers/EntityRsController.php @@ -4,15 +4,11 @@ use App\Mail\AskRs; use App\Models\Entity; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Mail; class EntityRsController extends Controller { - public function __construct() - { - - } - public function store(Entity $entity) { $this->authorize('update', $entity); @@ -26,4 +22,30 @@ public function store(Entity $entity) ->back() ->with('status', __('entities.rs_asked')); } + + public function rsState(Entity $entity) + { + $this->authorize('do-everything'); + + if ($entity->type->value !== 'sp') { + return redirect() + ->back() + ->with('status', __('categories.rs_controlled_for_sps_only')); + } + + $entity = DB::transaction(function () use ($entity) { + $entity->rs = $entity->rs ? false : true; + $entity->update(); + + return $entity; + }); + + $status = $entity->rs ? 'rs' : 'no_rs'; + $color = $entity->rs ? 'green' : 'red'; + + return redirect() + ->back() + ->with('status', __("entities.$status")) + ->with('color', $color); + } } diff --git a/resources/views/entities/partials/askrs.blade.php b/resources/views/entities/partials/askrs.blade.php index bab34b2..d6c0df0 100644 --- a/resources/views/entities/partials/askrs.blade.php +++ b/resources/views/entities/partials/askrs.blade.php @@ -1,4 +1,4 @@ -