summaryrefslogtreecommitdiff
path: root/users/app/models/user.rb
diff options
context:
space:
mode:
Diffstat (limited to 'users/app/models/user.rb')
-rw-r--r--users/app/models/user.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/users/app/models/user.rb b/users/app/models/user.rb
index a14fcb5..35212a1 100644
--- a/users/app/models/user.rb
+++ b/users/app/models/user.rb
@@ -9,6 +9,12 @@ class User < CouchRest::Model::Base
property :enabled, TrueClass, :default => true
+ # these will be null by default. should we set to APP_CONFIG[:default_service_level] by default, or have code assume that until these get set?:
+ property :desired_service_level, Integer, :accessible => true
+ property :effective_service_level, Integer, :accessible => true
+
+ before_save :update_effective_service_level
+
validates :login, :password_salt, :password_verifier,
:presence => true
@@ -116,4 +122,10 @@ class User < CouchRest::Model::Base
def serverside?
true
end
+
+ def update_effective_service_level
+ if self.desired_service_level_changed?
+ self.effective_service_level = self.desired_service_level
+ end
+ end
end