mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-12-26 01:18:21 +01:00
improve OS API
This commit is contained in:
parent
83288a00b0
commit
d135587c3b
@ -183,7 +183,9 @@ function SystemController:apigateway(...)
|
||||
print("Web socket is not available.")
|
||||
end
|
||||
else
|
||||
if REQUEST.json then
|
||||
if REQUEST.path then
|
||||
exec_with_user_priv(REQUEST)
|
||||
elseif REQUEST.json then
|
||||
data = JSON.decodeString(REQUEST.json)
|
||||
--std.json()
|
||||
exec_with_user_priv(data)
|
||||
|
@ -26,11 +26,20 @@ function sysdb()
|
||||
end
|
||||
|
||||
function is_auth()
|
||||
if SESSION.sessionid == nil or SESSION.sessionid == '0' then return false end
|
||||
local sessionid = nil
|
||||
if SESSION.sessionid and SESSION.sessionid ~= '0' then
|
||||
sessionid = SESSION.sessionid
|
||||
-- should be used only by API call
|
||||
elseif REQUEST.sessionid and REQUEST.sessionid ~= '0' then
|
||||
sessionid = REQUEST.sessionid
|
||||
end
|
||||
if sessionid == nil then
|
||||
return false
|
||||
end
|
||||
-- query session id from database
|
||||
local db = sysdb()
|
||||
if db == nil then return false end
|
||||
local cond = {exp= {["="] = { sessionid = SESSION.sessionid }}}
|
||||
local cond = {exp= {["="] = { sessionid = sessionid }}}
|
||||
local data = db:find(cond)
|
||||
--print(JSON.encode(data))
|
||||
db:close()
|
||||
|
Loading…
Reference in New Issue
Block a user