discourse/lib/staff_constraint.rb

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

21 lines
467 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class StaffConstraint
def matches?(request)
provider = Discourse.current_user_provider.new(request.env)
2018-03-28 13:48:14 -05:00
provider.current_user &&
provider.current_user.staff? &&
custom_staff_check(request)
rescue Discourse::InvalidAccess, Discourse::ReadOnly
false
end
2018-03-28 13:48:14 -05:00
# Extensibility point: plugins can overwrite this to add additional checks
# if they require.
def custom_staff_check(request)
true
end
end