diff --git a/base/aaa/user.go b/base/aaa/user.go index 8704036c..641f4149 100644 --- a/base/aaa/user.go +++ b/base/aaa/user.go @@ -36,21 +36,21 @@ func _user_modify(m *ice.Message, name string, arg ...string) { _user_create(m, name, "") } + m.Log_MODIFY(USERNAME, name, arg) m.Richs(USER, nil, name, func(key string, value map[string]interface{}) { - m.Log_MODIFY(USERNAME, name, arg) for i := 0; i < len(arg)-1; i += 2 { kit.Value(value, arg[i], arg[i+1]) } }) } func _user_create(m *ice.Message, name, word string) { - m.Rich(USER, nil, kit.Dict( + h := m.Rich(USER, nil, kit.Dict( USERNAME, name, PASSWORD, word, USERNICK, name, USERNODE, cli.NodeName, USERZONE, m.Option(ice.MSG_USERZONE), USERNODE, cli.NodeName, )) - m.Log_CREATE(USERNAME, name) + m.Log_CREATE(USERNAME, name, "hash", h) m.Event(gdb.USER_CREATE, name) } func _user_search(m *ice.Message, kind, name, text string, arg ...string) { @@ -119,8 +119,8 @@ func init() { mdb.CREATE: {Name: "create username [password]", Help: "创建", Hand: func(m *ice.Message, arg ...string) { _user_create(m, arg[0], kit.Select("", arg, 1)) }}, - mdb.MODIFY: {Name: "modify username [key value]...", Help: "编辑", Hand: func(m *ice.Message, arg ...string) { - _user_modify(m, m.Option("username"), arg[0], arg[1]) + mdb.MODIFY: {Name: "modify [key value]...", Help: "编辑", Hand: func(m *ice.Message, arg ...string) { + _user_modify(m, m.Option(USERNAME), arg...) }}, mdb.SEARCH: {Name: "search type name text arg...", Help: "搜索", Hand: func(m *ice.Message, arg ...string) { _user_search(m, arg[0], arg[1], kit.Select("", arg, 2)) diff --git a/base/nfs/nfs.go b/base/nfs/nfs.go index 7899408b..4d73c7d9 100644 --- a/base/nfs/nfs.go +++ b/base/nfs/nfs.go @@ -24,6 +24,11 @@ func _file_ext(name string) string { } func _file_list(m *ice.Message, root string, name string, level int, deep bool, dir_type string, dir_reg *regexp.Regexp, fields []string) { + switch strings.Split(name, "/")[0] { + case "etc", "var": + return + } + if fs, e := ioutil.ReadDir(path.Join(root, name)); e != nil { if f, e := os.Open(path.Join(root, name)); e == nil { defer f.Close() diff --git a/base/web/serve.go b/base/web/serve.go index c94a8cb9..3fed982b 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -19,6 +19,7 @@ import ( const LOGIN = "_login" func _serve_login(msg *ice.Message, cmds []string, w http.ResponseWriter, r *http.Request) ([]string, bool) { + msg.Debug("what", msg.Conf("aaa.user")) msg.Option(ice.MSG_USERNAME, "") msg.Option(ice.MSG_USERROLE, "") @@ -191,7 +192,15 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool { if r.ParseForm(); r.FormValue(ice.MSG_SESSID) != "" { return true } - if c, e := r.Cookie(ice.MSG_SESSID); e != nil || c.Value == "" { + + sessid := "" + if c, e := r.Cookie(ice.MSG_SESSID); e == nil { + m.Richs("aaa.sess", "", c.Value, func(key string, value map[string]interface{}) { + sessid = c.Value + }) + } + + if sessid == "" { http.Redirect(w, r, m.Conf(SERVE, "meta.sso"), http.StatusTemporaryRedirect) return false } diff --git a/core/chat/river.go b/core/chat/river.go index 322c4f00..a950c679 100644 --- a/core/chat/river.go +++ b/core/chat/river.go @@ -95,11 +95,16 @@ func init() { RIVER: {Name: "river", Help: "群组", Value: kit.Data( "template", kit.Dict( "base", kit.Dict( - "admin", []interface{}{ + "info", []interface{}{ "web.chat.user", "web.chat.tool", "web.chat.info", }, + "miss", []interface{}{ + "web.team.task", + "web.team.plan", + "web.wiki.word", + }, ), ), aaa.Black, kit.Dict(aaa.TECH, []interface{}{ @@ -238,9 +243,6 @@ func init() { _river_node(m, m.Option(ice.MSG_RIVER), arg...) }}, }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - if m.Option(ice.MSG_USERNICK) != "" { - m.Cmd(aaa.USER, mdb.MODIFY, m.Option(ice.MSG_USERNAME), aaa.USERNICK, m.Option(ice.MSG_USERNICK)) - } if len(arg) > 0 && arg[0] == "storm" { m.Cmdy("/storm", arg[1:]) return diff --git a/misc/lark/lark.go b/misc/lark/lark.go index c1051a2d..2111f833 100644 --- a/misc/lark/lark.go +++ b/misc/lark/lark.go @@ -524,14 +524,18 @@ var Index = &ice.Context{Name: "lark", Help: "机器人", "app_access_token", m.Cmdx(APP, "token", "bot"), )) + m.Option(aaa.USERZONE, LARK) m.Option(ice.MSG_USERROLE, aaa.ROOT) user := kit.Format(kit.Value(data, "data.open_id")) web.RenderCookie(m, aaa.SessCreate(m, user, aaa.UserRole(m, user))) m.Render("redirect", m.Conf(web.SHARE, "meta.domain")) - m.Debug("data %v", kit.Format(data)) - m.Cmd(aaa.USER, mdb.MODIFY, user, - aaa.USERNICK, kit.Value(data, "data.name"), + m.Option(aaa.USERNAME, user) + msg := m.Cmd(m.Prefix(USER), user) + m.Cmd(aaa.USER, mdb.MODIFY, aaa.USERZONE, LARK, aaa.USERNICK, msg.Append("name"), + "mobile", msg.Append("mobile"), "avatar_url", msg.Append("avatar_url"), + "gender", kit.Select("女", "男", msg.Append("gender") == "1"), + "country", msg.Append("country"), "city", msg.Append("city"), ) }) return diff --git a/misc/mp/mp.go b/misc/mp/mp.go index 9c57c7bb..c9671505 100644 --- a/misc/mp/mp.go +++ b/misc/mp/mp.go @@ -47,14 +47,13 @@ var Index = &ice.Context{Name: "mp", Help: "小程序", case "info": // 用户信息 - m.Cmd(aaa.USER, mdb.MODIFY, m.Option(ice.MSG_USERNAME), - "gender", m.Option("gender"), - "avatar", m.Option("avatarUrl"), - "usernick", m.Option("nickName"), + m.Option(aaa.USERNAME, m.Option(ice.MSG_USERNAME)) + m.Cmd(aaa.USER, mdb.MODIFY, aaa.USERZONE, MP, aaa.USERNICK, m.Option("nickName"), + "avatar_url", m.Option("avatarUrl"), + "gender", kit.Select("女", "男", m.Option("gender") == "1"), + "country", m.Option("country"), "city", m.Option("city"), "language", m.Option("language"), "province", m.Option("province"), - "country", m.Option("country"), - "city", m.Option("city"), ) case "scan":