support dedicated image servers

This commit is contained in:
r888888888
2018-01-03 11:42:08 -08:00
parent 3a5eaad685
commit af6ab74f8d
6 changed files with 39 additions and 24 deletions

View File

@@ -16,7 +16,21 @@ class CurrentUser
end
def self.as_admin(&block)
scoped(User.admins.first, "127.0.0.1", &block)
if block_given?
scoped(User.admins.first, "127.0.0.1", &block)
else
self.user = User.admins.first
self.ip_addr = "127.0.0.1"
end
end
def self.as_system(&block)
if block_given?
scoped(User.system, "127.0.0.1", &block)
else
self.user = User.system
self.ip_addr = "127.0.0.1"
end
end
def self.user=(user)