Module: UserConcerns
- Extended by:
- ActiveSupport::Concern
- Included in:
- User
- Defined in:
- app/models/concerns/user_concerns.rb
Instance Method Summary collapse
- #active? ⇒ Boolean
- #full_name ⇒ Object
- #has_role?(role) ⇒ Boolean
- #inactive!(_inactive = true) ⇒ Object
- #inactive? ⇒ Boolean
- #ldap_entry ⇒ Object
-
#roles ⇒ Object
Overridden by application.
- #superuser!(_superuser = true) ⇒ Object
- #superuser? ⇒ Boolean
Instance Method Details
#active? ⇒ Boolean
13 14 15 |
# File 'app/models/concerns/user_concerns.rb', line 13 def active? !inactive? end |
#full_name ⇒ Object
37 38 39 40 |
# File 'app/models/concerns/user_concerns.rb', line 37 def full_name return nil unless first_name || last_name "#{first_name} #{last_name}".strip end |
#has_role?(role) ⇒ Boolean
9 10 11 |
# File 'app/models/concerns/user_concerns.rb', line 9 def has_role?(role) superuser? || roles.include?(role) end |
#inactive!(_inactive = true) ⇒ Object
29 30 31 |
# File 'app/models/concerns/user_concerns.rb', line 29 def inactive!(_inactive=true) update_attribute(:inactive_flag, _inactive) end |
#inactive? ⇒ Boolean
17 18 19 |
# File 'app/models/concerns/user_concerns.rb', line 17 def inactive? inactive_flag end |
#ldap_entry ⇒ Object
33 34 35 |
# File 'app/models/concerns/user_concerns.rb', line 33 def ldap_entry UcbRailsUser::LdapPerson::Finder.find_by_uid!(uid) end |
#roles ⇒ Object
Overridden by application
5 6 7 |
# File 'app/models/concerns/user_concerns.rb', line 5 def roles [] end |
#superuser!(_superuser = true) ⇒ Object
21 22 23 |
# File 'app/models/concerns/user_concerns.rb', line 21 def superuser!(_superuser=true) update_attribute(:superuser_flag, _superuser) end |
#superuser? ⇒ Boolean
25 26 27 |
# File 'app/models/concerns/user_concerns.rb', line 25 def superuser? superuser_flag end |