Menu system conform / propagation CanAdmin
This commit is contained in:
parent
9bbbfbe91a
commit
53d323570b
5 changed files with 23 additions and 10 deletions
7
admin.go
7
admin.go
|
@ -75,6 +75,7 @@ func handleAdminActivateUsers(w http.ResponseWriter, r *http.Request) {
|
|||
UserNameAttr: config.UserNameAttr,
|
||||
UserBaseDN: config.UserBaseDN,
|
||||
Users: EntryList(sr.Entries),
|
||||
CanAdmin: login.CanAdmin,
|
||||
}
|
||||
templateAdminActivateUsers.Execute(w, data)
|
||||
|
||||
|
@ -134,6 +135,7 @@ func handleAdminUsers(w http.ResponseWriter, r *http.Request) {
|
|||
UserNameAttr: config.UserNameAttr,
|
||||
UserBaseDN: config.UserBaseDN,
|
||||
Users: EntryList(sr.Entries),
|
||||
CanAdmin: login.CanAdmin,
|
||||
}
|
||||
sort.Sort(data.Users)
|
||||
|
||||
|
@ -183,6 +185,7 @@ func handleAdminGroups(w http.ResponseWriter, r *http.Request) {
|
|||
GroupNameAttr: config.GroupNameAttr,
|
||||
GroupBaseDN: config.GroupBaseDN,
|
||||
Groups: EntryList(sr.Entries),
|
||||
CanAdmin: login.CanAdmin,
|
||||
}
|
||||
sort.Sort(data.Groups)
|
||||
|
||||
|
@ -223,6 +226,7 @@ func handleAdminMailing(w http.ResponseWriter, r *http.Request) {
|
|||
MailingNameAttr: config.MailingNameAttr,
|
||||
MailingBaseDN: config.MailingBaseDN,
|
||||
MailingLists: EntryList(sr.Entries),
|
||||
CanAdmin: login.CanAdmin,
|
||||
}
|
||||
sort.Sort(data.MailingLists)
|
||||
|
||||
|
@ -425,6 +429,7 @@ func handleAdminMailingList(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
Error: dError,
|
||||
Success: dSuccess,
|
||||
CanAdmin: login.CanAdmin,
|
||||
}
|
||||
sort.Sort(data.Members)
|
||||
sort.Sort(data.PossibleNewMembers)
|
||||
|
@ -912,6 +917,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
Error: dError,
|
||||
Success: dSuccess,
|
||||
CanAdmin: true,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1099,6 +1105,7 @@ func handleAdminCreate(w http.ResponseWriter, r *http.Request) {
|
|||
// }
|
||||
}
|
||||
}
|
||||
data.CanAdmin = true
|
||||
|
||||
templateAdminCreate.Execute(w, data)
|
||||
}
|
||||
|
|
1
home.go
1
home.go
|
@ -25,6 +25,7 @@ func handleHome(w http.ResponseWriter, r *http.Request) {
|
|||
Login: login,
|
||||
BaseDN: config.BaseDN,
|
||||
Org: config.Org,
|
||||
CanAdmin: login.CanAdmin,
|
||||
}
|
||||
|
||||
templateHome.Execute(w, data)
|
||||
|
|
|
@ -103,6 +103,7 @@ func handleLostPassword(w http.ResponseWriter, r *http.Request) {
|
|||
data.Success = true
|
||||
}
|
||||
}
|
||||
data.CanAdmin = false
|
||||
templateLostPasswordPage.Execute(w, data)
|
||||
}
|
||||
|
||||
|
@ -251,6 +252,7 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi
|
|||
} else {
|
||||
data.SuggestPW = fmt.Sprintf("%s", suggestPassword())
|
||||
}
|
||||
data.CanAdmin = false
|
||||
|
||||
templateInviteNewAccount.Execute(w, data)
|
||||
return data.Success
|
||||
|
@ -411,6 +413,7 @@ func handleInviteSendCode(w http.ResponseWriter, r *http.Request) {
|
|||
data.Success = true
|
||||
data.CodeDisplay = code
|
||||
}
|
||||
data.CanAdmin = login.CanAdmin
|
||||
|
||||
templateInviteSendCode.Execute(w, data)
|
||||
|
||||
|
|
3
login.go
3
login.go
|
@ -228,7 +228,7 @@ func handleLogin(w http.ResponseWriter, r *http.Request) *LoginInfo {
|
|||
templateLogin := getTemplate("login.html")
|
||||
|
||||
if r.Method == "GET" {
|
||||
templateLogin.Execute(w, LoginFormData{})
|
||||
templateLogin.Execute(w, LoginFormData{CanAdmin: false})
|
||||
return nil
|
||||
} else if r.Method == "POST" {
|
||||
// log.Printf("%v", "Parsing Form handleLogin")
|
||||
|
@ -250,6 +250,7 @@ func handleLogin(w http.ResponseWriter, r *http.Request) *LoginInfo {
|
|||
data := &LoginFormData{
|
||||
Username: username,
|
||||
Login: false,
|
||||
CanAdmin: false,
|
||||
}
|
||||
if ldap.IsErrorWithCode(err, ldap.LDAPResultInvalidCredentials) {
|
||||
data.WrongPass = true
|
||||
|
|
|
@ -39,7 +39,7 @@ func handleProfile(w http.ResponseWriter, r *http.Request) {
|
|||
Login: login,
|
||||
ErrorMessage: "",
|
||||
Success: false,
|
||||
CanAdmin: false,
|
||||
CanAdmin: login.CanAdmin,
|
||||
}
|
||||
|
||||
data.Mail = login.UserEntry.GetAttributeValue("mail")
|
||||
|
@ -177,6 +177,7 @@ func handleFoundPassword(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
}
|
||||
data.CanAdmin = false
|
||||
templateFoundPasswordPage.Execute(w, data)
|
||||
}
|
||||
|
||||
|
@ -216,6 +217,6 @@ func handlePasswd(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.CanAdmin = false
|
||||
templatePasswd.Execute(w, data)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue