1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-26 09:14:06 +08:00

add access

This commit is contained in:
shylinux 2019-06-07 13:20:22 +08:00
parent b133aa5ac4
commit 5c858eb440
3 changed files with 58 additions and 46 deletions

View File

@ -539,6 +539,15 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
} }
switch arg[0] { switch arg[0] {
case "access": // 查看用户
h := m.Cmdx("aaa.auth", "access", kit.Hashs(m.Option("remote_ip"), m.Option("username")))
m.Cmd("aaa.auth", h, "data",
"remote_ip", m.Option("remote_ip"),
"username", m.Option("username"),
)
m.Echo(h)
return
case "user": // 查看用户 case "user": // 查看用户
m.Log("fuck", "what %v", arg) m.Log("fuck", "what %v", arg)
m.Cmdy("aaa.auth", sid, "ship", "username") m.Cmdy("aaa.auth", sid, "ship", "username")

View File

@ -92,6 +92,9 @@ func (web *WEB) Login(msg *ctx.Message, w http.ResponseWriter, r *http.Request)
// if msg.Confs("skip_login", msg.Option("path")) { // if msg.Confs("skip_login", msg.Option("path")) {
// return true // return true
// } // }
defer func() {
msg.Option("access", msg.Cmdx("aaa.sess", "access"))
}()
if msg.Confs("login", "cas") { if msg.Confs("login", "cas") {
if !cas.IsAuthenticated(r) { if !cas.IsAuthenticated(r) {
r.URL, _ = r.URL.Parse(r.Header.Get("index_url")) r.URL, _ = r.URL.Parse(r.Header.Get("index_url"))

View File

@ -73,9 +73,9 @@ var Index = &ctx.Context{Name: "wiki", Help: "文档中心",
which := m.Cmdx("nfs.path", path.Join(m.Confx("wiki_level"), m.Option("wiki_class"), m.Confx("wiki_favor", arg, 0))) which := m.Cmdx("nfs.path", path.Join(m.Confx("wiki_level"), m.Option("wiki_class"), m.Confx("wiki_favor", arg, 0)))
if ls, e := ioutil.ReadFile(which); e == nil { if ls, e := ioutil.ReadFile(which); e == nil {
m.Confi("wiki_visit", []string{which, m.Option("remote_ip")}, m.Conf("wiki_visit", []string{which, m.Option("access")},
m.Confi("wiki_visit", []string{which, m.Option("remote_ip")})+1) m.Confi("wiki_visit", []string{which, m.Option("access")})+1)
m.Append("visit_count", m.Confi("wiki_visit", []string{which, m.Option("remote_ip")})) m.Append("visit_count", m.Confi("wiki_visit", []string{which, m.Option("access")}))
m.Append("visit_total", len(m.Confm("wiki_visit", []string{which}))) m.Append("visit_total", len(m.Confm("wiki_visit", []string{which})))
buffer := bytes.NewBuffer([]byte{}) buffer := bytes.NewBuffer([]byte{})