From 9f891bdb9a41de73f5970219b2557b4039358a4f Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 10 Feb 2020 09:44:18 +0100 Subject: [PATCH] Minor UI changes --- admin.go | 14 ++++++++++++-- templates/admin_create.html | 8 ++++---- templates/admin_groups.html | 3 ++- templates/admin_ldap.html | 8 +++----- templates/admin_users.html | 3 ++- templates/login.html | 7 +++++++ 6 files changed, 30 insertions(+), 13 deletions(-) diff --git a/admin.go b/admin.go index 33c63e7..8803531 100644 --- a/admin.go +++ b/admin.go @@ -50,6 +50,7 @@ func (d EntryList) Less(i, j int) bool { type AdminUsersTplData struct { Login *LoginStatus UserNameAttr string + UserBaseDN string Users EntryList } @@ -77,6 +78,7 @@ func handleAdminUsers(w http.ResponseWriter, r *http.Request) { data := &AdminUsersTplData{ Login: login, UserNameAttr: config.UserNameAttr, + UserBaseDN: config.UserBaseDN, Users: EntryList(sr.Entries), } sort.Sort(data.Users) @@ -87,6 +89,7 @@ func handleAdminUsers(w http.ResponseWriter, r *http.Request) { type AdminGroupsTplData struct { Login *LoginStatus GroupNameAttr string + GroupBaseDN string Groups EntryList } @@ -114,6 +117,7 @@ func handleAdminGroups(w http.ResponseWriter, r *http.Request) { data := &AdminGroupsTplData{ Login: login, GroupNameAttr: config.GroupNameAttr, + GroupBaseDN: config.GroupBaseDN, Groups: EntryList(sr.Entries), } sort.Sort(data.Groups) @@ -439,7 +443,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) { if val, ok := props["objectclass"]; ok { objectClass = val.Values } - hasMembers, hasGroups := false, false + hasMembers, hasGroups, isOrganization := false, false, false for _, oc := range objectClass { if strings.EqualFold(oc, "organizationalperson") || strings.EqualFold(oc, "person") { hasGroups = true @@ -447,6 +451,9 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) { if strings.EqualFold(oc, "groupOfNames") { hasMembers = true } + if strings.EqualFold(oc, "organization") { + isOrganization = true + } } templateAdminLDAP.Execute(w, &AdminLDAPTplData{ @@ -455,7 +462,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) { Path: path, Children: children, Props: props, - CanAddChild: dn_last_attr == "ou", + CanAddChild: dn_last_attr == "ou" || isOrganization, CanDelete: dn != config.BaseDN && len(children) == 0, HasMembers: len(members) > 0 || hasMembers, @@ -477,6 +484,7 @@ type CreateData struct { DisplayName string StructuralObjectClass string ObjectClass string + IsTemplated bool Error string } @@ -518,10 +526,12 @@ func handleAdminCreate(w http.ResponseWriter, r *http.Request) { data.IdType = config.UserNameAttr data.StructuralObjectClass = "inetOrgPerson" data.ObjectClass = "inetOrgPerson\norganizationalPerson\nperson\ntop" + data.IsTemplated = true } else if template == "group" { data.IdType = config.UserNameAttr data.StructuralObjectClass = "groupOfNames" data.ObjectClass = "groupOfNames\ntop" + data.IsTemplated = true } else { data.IdType = "cn" data.ObjectClass = "top" diff --git a/templates/admin_create.html b/templates/admin_create.html index 3e636a5..6e5aef1 100644 --- a/templates/admin_create.html +++ b/templates/admin_create.html @@ -3,7 +3,7 @@ {{define "body"}}

Créer un objet

- Retour + Menu principal
@@ -36,7 +36,7 @@
- +
@@ -44,11 +44,11 @@
- +
- +
diff --git a/templates/admin_groups.html b/templates/admin_groups.html index 8b5a4ef..b52dd92 100644 --- a/templates/admin_groups.html +++ b/templates/admin_groups.html @@ -4,7 +4,8 @@

Liste des groupes

- Retour + Nouveau groupe + Menu principal
diff --git a/templates/admin_ldap.html b/templates/admin_ldap.html index 193f4e6..4480d10 100644 --- a/templates/admin_ldap.html +++ b/templates/admin_ldap.html @@ -4,7 +4,7 @@

Explorateur LDAP

- Retour + Menu principal
@@ -37,12 +37,10 @@
{{if .CanAddChild}} -
-
{{end}} diff --git a/templates/admin_users.html b/templates/admin_users.html index 01d96d2..6a304f5 100644 --- a/templates/admin_users.html +++ b/templates/admin_users.html @@ -4,7 +4,8 @@

Liste des utilisateurs

- Retour + Nouvel utilisateur + Menu principal
diff --git a/templates/login.html b/templates/login.html index ed4d358..719c834 100644 --- a/templates/login.html +++ b/templates/login.html @@ -19,4 +19,11 @@ + +
+ +

Mot de passe oublié ? + Écrivez à coucou at deuxfleurs point fr + ou contactez directement votre administrateur favori.

+ {{end}}