1
0
mirror of https://github.com/lxsang/antd-lua-plugin synced 2024-12-29 02:38:22 +01:00
antd-lua-plugin/example-app/os/system/uman.lua
2018-09-19 15:08:49 +02:00

27 lines
493 B
Lua

local uman={}
uman.userinfo = function(user)
local info = {}
local uid = unix.uid(user)
if uid then
-- read the setting
-- use the decodeFile function of JSON instead
local file = require('fs.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