mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
Added role scopes to roleable
This commit is contained in:
@ -3,6 +3,12 @@ require 'active_support/concern'
|
||||
module Roleable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
scope :admins, -> { where(admin: true) }
|
||||
scope :moderators, -> { where(moderator: true) }
|
||||
scope :staff, -> { where("moderator or admin ") }
|
||||
end
|
||||
|
||||
# any user that is either a moderator or an admin
|
||||
def staff?
|
||||
admin || moderator
|
||||
|
Reference in New Issue
Block a user