From 9260c3d2b738e060adb078c12850ce3f1bbe4204 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Fri, 29 Nov 2013 10:52:29 +0800 Subject: [PATCH] Add Approval to User --- app/models/user/user.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/models/user/user.rb b/app/models/user/user.rb index 488b67d6..999c5bc3 100644 --- a/app/models/user/user.rb +++ b/app/models/user/user.rb @@ -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