mirror of
https://github.com/we-promise/sure.git
synced 2026-04-18 11:34:13 +00:00
- Removed the `Settings::SsoIdentitiesController` and views for a simplified user experience. - Moved SSO identity management to the Security settings page (`Settings::SecuritiesController`). - Updated locale keys and layout for the new structure. - Fixed unlink protection warnings and adjusted redirection path. - Cleaned up routes, helper methods, and redundant code.
51 lines
676 B
Ruby
51 lines
676 B
Ruby
# frozen_string_literal: true
|
|
|
|
class SsoProviderPolicy < ApplicationPolicy
|
|
# Only super admins can manage SSO providers (instance-wide auth config)
|
|
def index?
|
|
user&.super_admin?
|
|
end
|
|
|
|
def show?
|
|
user&.super_admin?
|
|
end
|
|
|
|
def create?
|
|
user&.super_admin?
|
|
end
|
|
|
|
def new?
|
|
create?
|
|
end
|
|
|
|
def update?
|
|
user&.super_admin?
|
|
end
|
|
|
|
def edit?
|
|
update?
|
|
end
|
|
|
|
def destroy?
|
|
user&.super_admin?
|
|
end
|
|
|
|
def toggle?
|
|
update?
|
|
end
|
|
|
|
def test_connection?
|
|
user&.super_admin?
|
|
end
|
|
|
|
class Scope < ApplicationPolicy::Scope
|
|
def resolve
|
|
if user&.super_admin?
|
|
scope.all
|
|
else
|
|
scope.none
|
|
end
|
|
end
|
|
end
|
|
end
|