Add extensibility to admin constraints
This commit is contained in:
parent
7b4e6d508b
commit
feec968801
|
@ -9,9 +9,17 @@ class AdminConstraint
|
||||||
def matches?(request)
|
def matches?(request)
|
||||||
return false if @require_master && RailsMultisite::ConnectionManagement.current_db != "default"
|
return false if @require_master && RailsMultisite::ConnectionManagement.current_db != "default"
|
||||||
provider = Discourse.current_user_provider.new(request.env)
|
provider = Discourse.current_user_provider.new(request.env)
|
||||||
provider.current_user && provider.current_user.admin?
|
provider.current_user &&
|
||||||
|
provider.current_user.admin? &&
|
||||||
|
custom_admin_check(request)
|
||||||
rescue Discourse::InvalidAccess
|
rescue Discourse::InvalidAccess
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Extensibility point: plugins can overwrite this to add additional checks
|
||||||
|
# if they require.
|
||||||
|
def custom_admin_check(request)
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue