1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-12-26 01:18:21 +01:00
antd-web-apps/os/libs/uman.lua
2018-09-12 18:31:25 +02:00

27 lines
490 B
Lua

local uman={}
uman.userinfo = function(user)
local info = {}
local uid = ulib.uid(user)
if uid then
-- read the setting
-- use the decodeFile function of JSON instead
local file = require('vfs').ospath("home:///").."/.settings.json"
local st = JSON.decodeFile(file)
if(st) then
info = st
end
info.user = {
username = user,
id = uid.id,
name = user,
groups = uid.groups
}
--print(JSON.encode(info))
return info
else
return {}
end
end
return uman