summaryrefslogtreecommitdiff
path: root/app/models/service_level.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-04-17 19:27:47 +0200
committerAzul <azul@leap.se>2014-04-17 19:27:47 +0200
commit7a9ece43bd61246b450471ed6bb1089570321e38 (patch)
treea20362ee5512e160498902ef7c0a094b3135201d /app/models/service_level.rb
parent614745c84cab37dd03f2bd8f06160fd01c7fabdb (diff)
make use of the UnauthorizedUser
Null Pattern for current_user - use it to get rid of some conditionals
Diffstat (limited to 'app/models/service_level.rb')
-rw-r--r--app/models/service_level.rb14
1 files changed, 13 insertions, 1 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