mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-11-20 02:18:20 +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.")
|
print("Web socket is not available.")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if REQUEST.json then
|
if REQUEST.path then
|
||||||
|
exec_with_user_priv(REQUEST)
|
||||||
|
elseif REQUEST.json then
|
||||||
data = JSON.decodeString(REQUEST.json)
|
data = JSON.decodeString(REQUEST.json)
|
||||||
--std.json()
|
--std.json()
|
||||||
exec_with_user_priv(data)
|
exec_with_user_priv(data)
|
||||||
|
@ -26,11 +26,20 @@ function sysdb()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function is_auth()
|
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
|
-- query session id from database
|
||||||
local db = sysdb()
|
local db = sysdb()
|
||||||
if db == nil then return false end
|
if db == nil then return false end
|
||||||
local cond = {exp= {["="] = { sessionid = SESSION.sessionid }}}
|
local cond = {exp= {["="] = { sessionid = sessionid }}}
|
||||||
local data = db:find(cond)
|
local data = db:find(cond)
|
||||||
--print(JSON.encode(data))
|
--print(JSON.encode(data))
|
||||||
db:close()
|
db:close()
|
||||||
|
Loading…
Reference in New Issue
Block a user