Module: UserConcerns

Extended by:
ActiveSupport::Concern
Included in:
User
Defined in:
app/models/concerns/user_concerns.rb

Instance Method Summary collapse

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/models/concerns/user_concerns.rb', line 13

def active?
  !inactive?
end

#full_nameObject



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

Returns:

  • (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

Returns:

  • (Boolean)


17
18
19
# File 'app/models/concerns/user_concerns.rb', line 17

def inactive?
  inactive_flag
end

#ldap_entryObject



33
34
35
# File 'app/models/concerns/user_concerns.rb', line 33

def ldap_entry
  UcbRailsUser::LdapPerson::Finder.find_by_uid!(uid)
end

#rolesObject

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

Returns:

  • (Boolean)


25
26
27
# File 'app/models/concerns/user_concerns.rb', line 25

def superuser?
  superuser_flag
end