Add Approval to User

This commit is contained in:
saurabhbhatia 2013-11-29 10:52:29 +08:00
parent 9bc79fddd7
commit 9260c3d2b7
1 changed files with 12 additions and 3 deletions

View File

@ -20,6 +20,7 @@ class User
field :office_tel
field :cache_dept,type: Hash
field :status_record,type: Hash
field :approved, type: Boolean, :default => false
has_and_belongs_to_many :approving_apps, class_name: 'AuthApproval', inverse_of: 'authorized_users'
has_and_belongs_to_many :managing_apps, class_name: 'AuthManager', inverse_of: 'authorized_users'
@ -296,9 +297,17 @@ class User
end
end
# def active_for_authentication?
# super && approved?
# end
def active_for_authentication?
super && approved?
end
def inactive_message
if !approved?
:not_approved
else
super
end
end
private