From b6aeb954c46ae92faf09c0a790e5b3536fbf658e Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Mon, 8 Dec 2025 10:33:29 +0000 Subject: [PATCH] Disable Captcha & Oauth Settings actions when read only (#1968) --- app/Filament/Admin/Pages/Settings.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Filament/Admin/Pages/Settings.php b/app/Filament/Admin/Pages/Settings.php index f7a8c9b63..5c52c9206 100644 --- a/app/Filament/Admin/Pages/Settings.php +++ b/app/Filament/Admin/Pages/Settings.php @@ -297,11 +297,13 @@ class Settings extends Page implements HasSchemas Actions::make([ Action::make("disable_captcha_$id") ->visible(fn (Get $get) => $get("CAPTCHA_{$id}_ENABLED")) + ->disabled(fn () => !user()?->can('update settings')) ->label(trans('admin/setting.captcha.disable')) ->color('danger') ->action(fn (Set $set) => $set("CAPTCHA_{$id}_ENABLED", false)), Action::make("enable_captcha_$id") ->visible(fn (Get $get) => !$get("CAPTCHA_{$id}_ENABLED")) + ->disabled(fn () => !user()?->can('update settings')) ->label(trans('admin/setting.captcha.enable')) ->color('success') ->action(fn (Set $set) => $set("CAPTCHA_{$id}_ENABLED", true)), @@ -568,11 +570,13 @@ class Settings extends Page implements HasSchemas Actions::make([ Action::make("disable_oauth_$id") ->visible(fn (Get $get) => $get($key)) + ->disabled(fn () => !user()?->can('update settings')) ->label(trans('admin/setting.oauth.disable')) ->color('danger') ->action(fn (Set $set) => $set($key, false)), Action::make("enable_oauth_$id") ->visible(fn (Get $get) => !$get($key)) + ->disabled(fn () => !user()?->can('update settings')) ->label(trans('admin/setting.oauth.enable')) ->color('success') ->steps($schema->getSetupSteps())