Files
discourse/lib/staff_constraint.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
418 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class StaffConstraint
def matches?(request)
current_user = CurrentUser.lookup_from_env(request.env)
current_user&.staff? && custom_staff_check(request)
rescue Discourse::InvalidAccess, Discourse::ReadOnly
2017-08-10 18:27:01 +09:00
false
end
2018-03-28 14:48:14 -04:00
# Extensibility point: plugins can overwrite this to add additional checks
# if they require.
def custom_staff_check(request)
true
end
end