Module: UserConcerns
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/wobauth/concerns/models/user_concerns.rb
Instance Method Summary collapse
Instance Method Details
#is_admin? ⇒ Boolean
30 31 32 |
# File 'lib/wobauth/concerns/models/user_concerns.rb', line 30 def is_admin? role?(:admin) end |
#name ⇒ Object
26 27 28 |
# File 'lib/wobauth/concerns/models/user_concerns.rb', line 26 def name to_s end |
#role?(role) ⇒ Boolean
34 35 36 37 38 39 |
# File 'lib/wobauth/concerns/models/user_concerns.rb', line 34 def role?(role) (self..joins(:role) .where("wobauth_roles.name = ?", role.to_s.camelize).present?) || (self..joins(:role) .where("wobauth_roles.name = ?", role.to_s.camelize).present?) end |
#to_s ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/wobauth/concerns/models/user_concerns.rb', line 16 def to_s if sn.blank? and givenname.blank? "#{username}" elsif title.blank? "#{sn}, #{givenname} (#{username})" else "#{sn}, #{title} #{givenname} (#{username})" end end |