1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-25 17:18:05 +08:00

opt status

This commit is contained in:
shaoying 2021-05-08 00:06:09 +08:00
parent ed97853635
commit 1ae76b6c99
3 changed files with 12 additions and 4 deletions

View File

@ -42,6 +42,14 @@ func _user_search(m *ice.Message, kind, name, text string) {
})
}
func UserRoot(m *ice.Message) {
m.Option(ice.MSG_USERNAME, ice.Info.UserName)
m.Option(ice.MSG_USERROLE, ROOT)
if m.Richs(USER, "", ice.Info.UserName, nil) == nil {
_user_create(m, ice.Info.UserName, kit.Hashs())
}
}
func UserZone(m *ice.Message, username interface{}) (zone string) {
m.Richs(USER, nil, kit.Format(username), func(key string, value map[string]interface{}) {
value = kit.GetMeta(value)

View File

@ -290,9 +290,8 @@ func (f *Frame) Start(m *ice.Message, arg ...string) bool {
r, f.stdout = os.Stdin, os.Stdout
m.Option(ice.MSG_OPTS, ice.MSG_USERNAME)
m.Option(ice.MSG_USERNAME, ice.Info.UserName)
m.Option(ice.MSG_USERROLE, aaa.ROOT)
m.Option(ice.MSG_USERZONE, "boot")
aaa.UserRoot(m)
default:
f.target = m.Source()

View File

@ -157,8 +157,9 @@ func _serve_login(msg *ice.Message, cmds []string, w http.ResponseWriter, r *htt
aaa.SessCheck(msg, msg.Option(ice.MSG_SESSID))
// 会话认证
}
if msg.Option(ice.MSG_USERNAME) == "" && tcp.IsLocalHost(msg, msg.Option(ice.MSG_USERIP)) && msg.Conf(SERVE, kit.Keym(tcp.LOCALHOST)) == "true" {
aaa.UserLogin(msg, ice.Info.UserName, ice.Info.PassWord)
aaa.UserRoot(msg)
// 主机认证
}