summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/service_level.rb14
-rw-r--r--app/models/unauthenticated_user.rb20
2 files changed, 30 insertions, 4 deletions
diff --git a/app/models/service_level.rb b/app/models/service_level.rb
index 31a713b..d0bd9b3 100644
--- a/app/models/service_level.rb
+++ b/app/models/service_level.rb
@@ -13,8 +13,20 @@ class ServiceLevel
end
def config_hash
- APP_CONFIG[:service_levels][@id]
+ @config_hash || APP_CONFIG[:service_levels][@id].with_indifferent_access
end
delegate :to_json, to: :config_hash
+
+ def provides?(service)
+ services.include? service.to_s
+ end
+
+ def services
+ config_hash[:services] || []
+ end
+
+ def cert_prefix
+ config_hash[:cert_prefix]
+ end
end
diff --git a/app/models/unauthenticated_user.rb b/app/models/unauthenticated_user.rb
index ba6470a..7845a6f 100644
--- a/app/models/unauthenticated_user.rb
+++ b/app/models/unauthenticated_user.rb
@@ -1,13 +1,27 @@
# The nil object for the user class
class UnauthenticatedUser < Object
- # will probably want something here to return service level as APP_CONFIG[:service_levels][0] but not sure how will be accessing.
+ def effective_service_level
+ ServiceLevel.new id: APP_CONFIG[:unauthenticated_service_level]
+ end
def is_admin?
false
end
- def effective_service_level
- ServiceLevel.new id: APP_CONFIG[:unauthenticated_service_level]
+ def id
+ nil
+ end
+
+ def email_address
+ nil
+ end
+
+ def login
+ nil
+ end
+
+ def messages
+ []
end
end