Module: Models::User
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/concerns/models/user.rb
Instance Method Summary collapse
Instance Method Details
#is_admin? ⇒ Boolean
32 33 34 |
# File 'lib/concerns/models/user.rb', line 32 def is_admin? role?(:admin) end |
#name ⇒ Object
28 29 30 |
# File 'lib/concerns/models/user.rb', line 28 def name to_s end |
#role?(role) ⇒ Boolean
36 37 38 39 40 41 |
# File 'lib/concerns/models/user.rb', line 36 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
18 19 20 21 22 23 24 25 26 |
# File 'lib/concerns/models/user.rb', line 18 def to_s if sn.blank? and givenname.blank? "#{username}" elsif title.blank? "#{sn}, #{givenname} (#{username})" else "#{sn}, #{title} #{givenname} (#{username})" end end |