2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-08-17 18:04:11 +08:00
discourse/lib/staff_constraint.rb
2023-01-09 12:10:19 +00:00

16 lines
416 B
Ruby

# 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
false
end
# Extensibility point: plugins can overwrite this to add additional checks
# if they require.
def custom_staff_check(request)
true
end
end