Sha256: 0850a2d08660f1583d5e170a44cdbaf665614167d67b4cee63d363c8d8a4072b
Contents?: true
Size: 877 Bytes
Versions: 1
Compression:
Stored size: 877 Bytes
Contents
class UcbRails::User < ActiveRecord::Base self.table_name = 'users' # attr_accessible :uid, :first_name, :last_name, :inactive before_validation :set_first_last_name # Overridden by application def roles [] end def has_role?(role) admin? || roles.include?(role) end def active? !inactive? end def admin!(_admin=true) update_attribute(:admin, _admin) end def inactive!(_inactive=true) update_attribute(:inactive, _inactive) end def self.active where(inactive: false) end def self.admin where(admin: true) end def ldap_entry UcbRails::LdapPerson::Finder.find_by_uid!(uid) end def full_name "#{first_name} #{last_name}" end private def set_first_last_name self.first_last_name = [first_name, last_name] .select { |n| n.present? } .join(' ') .presence end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ucb_rails-0.0.14 | app/models/ucb_rails/user.rb |