Extensibility for custom staff check
This commit is contained in:
parent
6aef8f9cd9
commit
a8f211bd41
|
@ -4,9 +4,17 @@ class StaffConstraint
|
||||||
|
|
||||||
def matches?(request)
|
def matches?(request)
|
||||||
provider = Discourse.current_user_provider.new(request.env)
|
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
|
rescue Discourse::InvalidAccess
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Extensibility point: plugins can overwrite this to add additional checks
|
||||||
|
# if they require.
|
||||||
|
def custom_staff_check(request)
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue