2022-04-12 15:20:10 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Check the access policies for API::AuthProvidersController
|
2016-03-23 18:39:41 +01:00
|
|
|
class AuthProviderPolicy < ApplicationPolicy
|
|
|
|
|
|
|
|
class Scope < Scope
|
|
|
|
def resolve
|
2022-04-13 16:23:13 +02:00
|
|
|
scope.includes(:providable, :auth_provider_mappings)
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-04-12 15:20:10 +02:00
|
|
|
%w[index? show? create? update? destroy? mapping_fields? strategy_name?].each do |action|
|
2016-03-23 18:39:41 +01:00
|
|
|
define_method action do
|
2019-01-14 12:57:31 +01:00
|
|
|
user.admin?
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def active?
|
|
|
|
user
|
|
|
|
end
|
|
|
|
|
2016-12-15 14:16:24 +01:00
|
|
|
def send_code?
|
|
|
|
user
|
|
|
|
end
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|