add basic support for safe mode

This commit is contained in:
r888888888
2013-07-17 13:59:44 -07:00
parent 01057a9cd5
commit 49d2df80f6
5 changed files with 43 additions and 6 deletions

View File

@@ -42,6 +42,18 @@ class CurrentUser
user.name
end
def self.safe_mode?
Thread.current[:safe_mode]
end
def self.set_safe_mode(req)
if req.host =~ /safe/
Thread.current[:safe_mode] = true
else
Thread.current[:safe_mode] = false
end
end
def self.method_missing(method, *params, &block)
if user.respond_to?(method)
user.__send__(method, *params, &block)