2013-05-02 01:15:17 -04:00
|
|
|
require_dependency 'current_user'
|
|
|
|
|
2013-05-02 03:22:27 -04:00
|
|
|
class StaffConstraint
|
2013-05-02 01:15:17 -04:00
|
|
|
|
|
|
|
def matches?(request)
|
2013-10-09 00:10:37 -04:00
|
|
|
provider = Discourse.current_user_provider.new(request.env)
|
|
|
|
provider.current_user && provider.current_user.staff?
|
2017-08-10 05:27:01 -04:00
|
|
|
rescue Discourse::InvalidAccess
|
|
|
|
false
|
2013-05-02 01:15:17 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|