Providers sharing (#1273)

* third party provider scoping

* Simplify logic and allow only admins to mange providers

* Broadcast fixes

* FIX tests and build

* Fixes

* Reviews

* Scope merchants

* DRY fixes
This commit is contained in:
soky srm
2026-03-25 17:47:04 +01:00
committed by GitHub
parent 1627cf197b
commit 9410e5b38d
74 changed files with 588 additions and 583 deletions

View File

@@ -1,7 +1,7 @@
class ApplicationController < ActionController::Base
include RestoreLayoutPreferences, Onboardable, Localize, AutoSync, Authentication, Invitable,
SelfHostable, StoreLocation, Impersonatable, Breadcrumbable,
FeatureGuardable, Notifiable, SafePagination
FeatureGuardable, Notifiable, SafePagination, AccountAuthorizable
include Pundit::Authorization
include Pagy::Backend
@@ -40,6 +40,17 @@ class ApplicationController < ActionController::Base
session[:pending_invitation_token] = token if invitation
end
def require_admin!
return if Current.user&.admin?
respond_to do |format|
format.html { redirect_to accounts_path, alert: t("shared.require_admin") }
format.turbo_stream { head :forbidden }
format.json { head :forbidden }
format.any { head :forbidden }
end
end
def detect_os
user_agent = request.user_agent
@os = case user_agent