moved System Administration link back into Administration community, fixed up some bugs around that
This commit is contained in:
+9
-1
@@ -19,6 +19,14 @@ import (
|
|||||||
"golang.org/x/text/language/display"
|
"golang.org/x/text/language/display"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/* ShowCommunity renders the community profile display.
|
||||||
|
* Parameters:
|
||||||
|
* ctxt - The AmContext for the request.
|
||||||
|
* Returns:
|
||||||
|
* Command string dictating what to be rendered.
|
||||||
|
* Data as a parameter for the command string.
|
||||||
|
* Standard Go error status.
|
||||||
|
*/
|
||||||
func ShowCommunity(ctxt ui.AmContext) (string, any, error) {
|
func ShowCommunity(ctxt ui.AmContext) (string, any, error) {
|
||||||
me := ctxt.CurrentUser()
|
me := ctxt.CurrentUser()
|
||||||
prefs, err := me.Prefs()
|
prefs, err := me.Prefs()
|
||||||
@@ -103,7 +111,7 @@ func ShowCommunity(ctxt ui.AmContext) (string, any, error) {
|
|||||||
ctxt.VarMap().Set("addrLast", b.String())
|
ctxt.VarMap().Set("addrLast", b.String())
|
||||||
if ci.Country != nil && *ci.Country != "" {
|
if ci.Country != nil && *ci.Country != "" {
|
||||||
country := countries.ByName(*ci.Country)
|
country := countries.ByName(*ci.Country)
|
||||||
ctxt.VarMap().Set("country", country.String())
|
ctxt.VarMap().Set("country", country.Emoji()+" "+country.String())
|
||||||
}
|
}
|
||||||
tag, err := comm.LanguageTag()
|
tag, err := comm.LanguageTag()
|
||||||
if err == nil && tag != nil {
|
if err == nil && tag != nil {
|
||||||
|
|||||||
@@ -27,6 +27,15 @@ domains:
|
|||||||
linkSequence: 5000
|
linkSequence: 5000
|
||||||
link: "/TODO/comm/[CID]/admin"
|
link: "/TODO/comm/[CID]/admin"
|
||||||
title: "Administration"
|
title: "Administration"
|
||||||
|
- id: "SysAdmin"
|
||||||
|
index: 2
|
||||||
|
default: false
|
||||||
|
locked: true
|
||||||
|
requirePermission: "Global.SysAdminAccess"
|
||||||
|
requireRole: ""
|
||||||
|
linkSequence: 10000
|
||||||
|
link: "/sysadmin"
|
||||||
|
title: "System Administration"
|
||||||
- id: "Conference"
|
- id: "Conference"
|
||||||
index: 3
|
index: 3
|
||||||
default: true
|
default: true
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ func SysAdminMenu(ctxt ui.AmContext) (string, any, error) {
|
|||||||
ctxt.SetRC(http.StatusForbidden)
|
ctxt.SetRC(http.StatusForbidden)
|
||||||
return ui.ErrorPage(ctxt, errors.New("you are not authorized access to this page"))
|
return ui.ErrorPage(ctxt, errors.New("you are not authorized access to this page"))
|
||||||
}
|
}
|
||||||
ctxt.SetLeftMenu("top")
|
|
||||||
menu := ui.AmMenu("sysadmin")
|
menu := ui.AmMenu("sysadmin")
|
||||||
ctxt.VarMap().Set("menu", menu)
|
ctxt.VarMap().Set("menu", menu)
|
||||||
ctxt.VarMap().Set("amsterdam_pageTitle", menu.Title)
|
ctxt.VarMap().Set("amsterdam_pageTitle", menu.Title)
|
||||||
|
|||||||
+21
-9
@@ -12,6 +12,7 @@ package ui
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -279,15 +280,20 @@ func (c *amContext) SetCommunityContext(param string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
mbr, lock, level, err := comm.Membership(c.CurrentUser())
|
if c.community == nil || c.community.Id != comm.Id {
|
||||||
if err != nil {
|
mbr, lock, level, err := comm.Membership(c.CurrentUser())
|
||||||
return err
|
if err != nil {
|
||||||
}
|
return err
|
||||||
c.community = comm
|
}
|
||||||
c.isMember = mbr
|
c.community = comm
|
||||||
c.isMemberLocked = lock
|
c.isMember = mbr
|
||||||
if level > c.effectiveLevel {
|
c.isMemberLocked = lock
|
||||||
c.effectiveLevel = level
|
if level > c.effectiveLevel {
|
||||||
|
c.effectiveLevel = level
|
||||||
|
}
|
||||||
|
if mbr {
|
||||||
|
c.session.Values["lastCommunity"] = comm.Id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -421,6 +427,12 @@ func AmCreateContext(ctxt echo.Context) (AmContext, error) {
|
|||||||
rc.user = nil
|
rc.user = nil
|
||||||
rc.effectiveLevel = database.AmRole("NotInList").Level()
|
rc.effectiveLevel = database.AmRole("NotInList").Level()
|
||||||
}
|
}
|
||||||
|
if !rc.user.IsAnon {
|
||||||
|
cp, ok := sess.Values["lastCommunity"]
|
||||||
|
if ok {
|
||||||
|
rc.SetCommunityContext(fmt.Sprintf("%d", cp))
|
||||||
|
}
|
||||||
|
}
|
||||||
return rc, err
|
return rc, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ menudefs:
|
|||||||
disabled: true
|
disabled: true
|
||||||
- text: "About Amsterdam"
|
- text: "About Amsterdam"
|
||||||
link: "/about"
|
link: "/about"
|
||||||
- text: "System Administration"
|
|
||||||
link: "/sysadmin"
|
|
||||||
permission: "Global.SysAdminAccess"
|
|
||||||
- id: "sysadmin"
|
- id: "sysadmin"
|
||||||
title: "System Administration"
|
title: "System Administration"
|
||||||
permSet: "user"
|
permSet: "user"
|
||||||
|
|||||||
+1
-1
@@ -416,7 +416,7 @@ func ShowProfile(ctxt ui.AmContext) (string, any, error) {
|
|||||||
ctxt.VarMap().Set("addrLast", b.String())
|
ctxt.VarMap().Set("addrLast", b.String())
|
||||||
if ci.Country != nil {
|
if ci.Country != nil {
|
||||||
country := countries.ByName(*ci.Country)
|
country := countries.ByName(*ci.Country)
|
||||||
ctxt.VarMap().Set("country", country.String())
|
ctxt.VarMap().Set("country", country.Emoji()+" "+country.String())
|
||||||
}
|
}
|
||||||
if !pvtPhone && ci.Phone != nil {
|
if !pvtPhone && ci.Phone != nil {
|
||||||
ctxt.VarMap().Set("phone", *ci.Phone)
|
ctxt.VarMap().Set("phone", *ci.Phone)
|
||||||
|
|||||||
Reference in New Issue
Block a user