mirror of
https://shylinux.com/x/icebergs
synced 2025-04-28 10:12:02 +08:00
opt some
This commit is contained in:
parent
c83cac512b
commit
fcdc32b253
@ -30,7 +30,11 @@ func _user_create(m *ice.Message, role, name, word string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if word == "" {
|
if word == "" {
|
||||||
word = kit.Hashs()
|
if m.Richs(USER, nil, name, func(key string, value map[string]interface{}) {
|
||||||
|
word = kit.Format(value[PASSWORD])
|
||||||
|
}) == nil {
|
||||||
|
word = kit.Hashs()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m.Rich(USER, nil, kit.Dict(USERROLE, role, USERNAME, name, PASSWORD, word))
|
m.Rich(USER, nil, kit.Dict(USERROLE, role, USERNAME, name, PASSWORD, word))
|
||||||
m.Event(USER_CREATE, USER, name)
|
m.Event(USER_CREATE, USER, name)
|
||||||
@ -44,11 +48,11 @@ func _user_search(m *ice.Message, name, text string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func UserRoot(m *ice.Message, arg ...string) { // password username userrole
|
func UserRoot(m *ice.Message, arg ...string) { // password username userrole
|
||||||
userrole := kit.Select(ROOT, arg, 2)
|
userrole := m.Option(ice.MSG_USERROLE, kit.Select(ROOT, arg, 2))
|
||||||
username := kit.Select(kit.Select("root", ice.Info.UserName), arg, 1)
|
username := m.Option(ice.MSG_USERNAME, kit.Select(kit.Select(ROOT, ice.Info.UserName), arg, 1))
|
||||||
m.Option(ice.MSG_USERROLE, userrole)
|
if len(arg) > 0 {
|
||||||
m.Option(ice.MSG_USERNAME, username)
|
_user_create(m, userrole, username, kit.Select("", arg, 0))
|
||||||
_user_create(m, userrole, username, kit.Select("", arg, 0))
|
}
|
||||||
}
|
}
|
||||||
func UserRole(m *ice.Message, username interface{}) (role string) {
|
func UserRole(m *ice.Message, username interface{}) (role string) {
|
||||||
if role = VOID; username == ice.Info.UserName {
|
if role = VOID; username == ice.Info.UserName {
|
||||||
|
@ -30,12 +30,10 @@ func _system_cmd(m *ice.Message, arg ...string) *exec.Cmd {
|
|||||||
// 环境变量
|
// 环境变量
|
||||||
env := kit.Simple(m.Optionv(CMD_ENV))
|
env := kit.Simple(m.Optionv(CMD_ENV))
|
||||||
for i := 0; i < len(env)-1; i += 2 {
|
for i := 0; i < len(env)-1; i += 2 {
|
||||||
cmd.Env = append(cmd.Env, kit.Format("%s=%s", env[i], env[i+1]))
|
if cmd.Env = append(cmd.Env, kit.Format("%s=%s", env[i], env[i+1])); env[i] == PATH {
|
||||||
if env[i] == PATH {
|
|
||||||
if file := _system_find(m, arg[0], strings.Split(env[i+1], ice.DF)...); file != "" {
|
if file := _system_find(m, arg[0], strings.Split(env[i+1], ice.DF)...); file != "" {
|
||||||
m.Debug("cmd: %v", file)
|
m.Debug("cmd: %v", file)
|
||||||
cmd.Path = file
|
cmd.Path = file
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,6 @@ func init() { ice.Cmd("{{.Option "key"}}", {{.Option "name"}}{}) }
|
|||||||
m.Option("tags", "`"+m.Option("tags")+"`")
|
m.Option("tags", "`"+m.Option("tags")+"`")
|
||||||
if buf, err := kit.Render(m.Option(mdb.TEXT), m); !m.Warn(err) {
|
if buf, err := kit.Render(m.Option(mdb.TEXT), m); !m.Warn(err) {
|
||||||
m.Cmd(nfs.DEFS, path.Join(m.Option(nfs.PATH), m.Option(nfs.FILE)), string(buf))
|
m.Cmd(nfs.DEFS, path.Join(m.Option(nfs.PATH), m.Option(nfs.FILE)), string(buf))
|
||||||
m.Debug("what %v", m.FormatMeta())
|
|
||||||
switch kit.Ext(m.Option(nfs.FILE)) {
|
switch kit.Ext(m.Option(nfs.FILE)) {
|
||||||
case GO:
|
case GO:
|
||||||
if m.Option(MAIN) != "" && m.Option(mdb.ZONE) != "" {
|
if m.Option(MAIN) != "" && m.Option(mdb.ZONE) != "" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user