mirror of
https://github.com/we-promise/sure.git
synced 2026-04-12 16:47:22 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user