aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorXinhui2016-05-12 10:14:37 +0200
committerXinhui2016-05-13 18:17:03 +0200
commit24f83ed286f1a2cbc8adc3051ab319b29a8bbf79 (patch)
tree0294cc99da32c71ad207b62ce0342c9202991d3d /app/models/user.rb
parent2cb49d26214f9082fa00fe58ee1c1388e45a34ed (diff)
downloadchouette-core-24f83ed286f1a2cbc8adc3051ab319b29a8bbf79.tar.bz2
Merge cas_client into master
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb26
1 files changed, 20 insertions, 6 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index bbde7d0d9..019249699 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,13 +1,16 @@
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
- # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
- devise :invitable, :database_authenticatable, :registerable,
- :recoverable, :rememberable, :trackable, :validatable,
- :confirmable, :async
+ # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable, :database_authenticatable
+ devise :invitable, :registerable, :validatable,
+ :recoverable, :rememberable, :trackable,
+ :confirmable, :async, :cas_authenticatable
+
+ # FIXME https://github.com/nbudin/devise_cas_authenticatable/issues/53
+ # Work around :validatable, when database_authenticatable is diabled.
+ attr_accessor :password
# Setup accessible (or protected) attributes for your model
# attr_accessible :email, :password, :current_password, :password_confirmation, :remember_me, :name, :organisation_attributes
-
belongs_to :organisation
accepts_nested_attributes_for :organisation
@@ -20,9 +23,20 @@ class User < ActiveRecord::Base
self.password ||= Devise.friendly_token.first(6)
self.password_confirmation ||= self.password
end
-
after_destroy :check_destroy_organisation
+ def cas_extra_attributes=(extra_attributes)
+ extra_attributes.each do |name, value|
+ # case name.to_sym
+ # Extra attributes
+ # when :fullname
+ # self.fullname = value
+ # when :email
+ # self.email = value
+ # end
+ end
+ end
+
private
# remove organisation and referentials if last user of it