summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-05-13 10:52:55 +0200
committerAzul <azul@leap.se>2014-05-13 10:52:55 +0200
commit0261e82686ec4fcfc8b633664fadb1dd6d9c8070 (patch)
tree7c8401d59f2bccf5c9e46263e89be26afcea4857 /app
parent86eb9062f1e81302647bf18ce0f5fd981202b68a (diff)
keep empty email field if user removed prefill
We should respect the users choice. We can still get their email from the user id if we really need to.
Diffstat (limited to 'app')
-rw-r--r--app/models/service_level.rb8
-rw-r--r--app/models/user.rb4
2 files changed, 11 insertions, 1 deletions
diff --git a/app/models/service_level.rb b/app/models/service_level.rb
index 5dd8838..a8df55b 100644
--- a/app/models/service_level.rb
+++ b/app/models/service_level.rb
@@ -24,6 +24,14 @@ class ServiceLevel
end
end
+ def provides?(service)
+ services.include? service
+ end
+
+ def services
+ config_hash[:services] || []
+ end
+
protected
def limited_cert?
diff --git a/app/models/user.rb b/app/models/user.rb
index c297ac8..a809879 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -62,7 +62,9 @@ class User < CouchRest::Model::Base
end
def email_address
- LocalEmail.new(login)
+ if effective_service_level.provides?('email')
+ LocalEmail.new(login)
+ end
end
# Since we are storing admins by login, we cannot allow admins to change their login.