Extensibility for custom staff check

This commit is contained in:
Robin Ward 2018-03-28 14:48:14 -04:00
parent 6aef8f9cd9
commit a8f211bd41
1 changed files with 9 additions and 1 deletions

View File

@ -4,9 +4,17 @@ class StaffConstraint
def matches?(request)
provider = Discourse.current_user_provider.new(request.env)
provider.current_user && provider.current_user.staff?
provider.current_user &&
provider.current_user.staff? &&
custom_staff_check(request)
rescue Discourse::InvalidAccess
false
end
# Extensibility point: plugins can overwrite this to add additional checks
# if they require.
def custom_staff_check(request)
true
end
end