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)
|
|
|
|
return false unless request.session[:current_user_id].present?
|
|
|
|
User.where("admin = 't' or moderator = 't'").where(id: request.session[:current_user_id].to_i).exists?
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|