summaryrefslogtreecommitdiff
path: root/app/models/unauthenticated_user.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/unauthenticated_user.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/unauthenticated_user.rb')
-rw-r--r--app/models/unauthenticated_user.rb20
1 files changed, 17 insertions, 3 deletions
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