1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-11-20 02:18:20 +01:00

enhance info

This commit is contained in:
lxsang 2020-06-17 20:07:50 +02:00
parent ac9f56b86d
commit ffba8f7c7c

View File

@ -26,6 +26,7 @@ require(BASE_FRW.."silk.api")
local REGISTRY = {} local REGISTRY = {}
-- set logging level -- set logging level
REGISTRY.logger = Logger:new{ levels = {INFO = false, ERROR = true, DEBUG = false}} REGISTRY.logger = Logger:new{ levels = {INFO = false, ERROR = true, DEBUG = false}}
REGISTRY.users_allowed = { phuong = true, mrsang = true }
REGISTRY.user = "mrsang" REGISTRY.user = "mrsang"
REGISTRY.db = DBHelper:new{db=REGISTRY.user} REGISTRY.db = DBHelper:new{db=REGISTRY.user}
REGISTRY.layout = 'default' REGISTRY.layout = 'default'
@ -61,6 +62,11 @@ BaseController:subclass("NotfoundController",{ registry = {}, models = {} })
function NotfoundController:index(...) function NotfoundController:index(...)
local args = {...} local args = {...}
local user = args[1]:gsub("Controller", ""):lower(); local user = args[1]:gsub("Controller", ""):lower();
if not REGISTRY.users_allowed[user] then
self:error("404: Controller "..args[1].." not found : "..args[2])
return
end
REQUEST.r = "index/"..std.trim(REQUEST.r:gsub(user, ""), "/") REQUEST.r = "index/"..std.trim(REQUEST.r:gsub(user, ""), "/")
if REGISTRY.db then REGISTRY.db:close() end if REGISTRY.db then REGISTRY.db:close() end
REGISTRY.user = user REGISTRY.user = user