From ffba8f7c7c69fac7271baad5a958f574868dbd02 Mon Sep 17 00:00:00 2001 From: lxsang Date: Wed, 17 Jun 2020 20:07:50 +0200 Subject: [PATCH] enhance info --- info/router.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/info/router.lua b/info/router.lua index fcfa16c..af67739 100644 --- a/info/router.lua +++ b/info/router.lua @@ -26,6 +26,7 @@ require(BASE_FRW.."silk.api") local REGISTRY = {} -- set logging level REGISTRY.logger = Logger:new{ levels = {INFO = false, ERROR = true, DEBUG = false}} +REGISTRY.users_allowed = { phuong = true, mrsang = true } REGISTRY.user = "mrsang" REGISTRY.db = DBHelper:new{db=REGISTRY.user} REGISTRY.layout = 'default' @@ -61,6 +62,11 @@ BaseController:subclass("NotfoundController",{ registry = {}, models = {} }) function NotfoundController:index(...) local args = {...} 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, ""), "/") if REGISTRY.db then REGISTRY.db:close() end REGISTRY.user = user