diff options
author | Alex Auvolat <alex@adnab.me> | 2020-02-10 09:44:18 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-02-10 09:44:18 +0100 |
commit | 9f891bdb9a41de73f5970219b2557b4039358a4f (patch) | |
tree | 703079e5b19a80dd74ed3b2f1495d89552ee3445 | |
parent | a6114cda7cc145c9f8f2bb0d2f1fd47e94ae845c (diff) | |
download | guichet-9f891bdb9a41de73f5970219b2557b4039358a4f.tar.gz guichet-9f891bdb9a41de73f5970219b2557b4039358a4f.zip |
Minor UI changes
-rw-r--r-- | admin.go | 14 | ||||
-rw-r--r-- | templates/admin_create.html | 8 | ||||
-rw-r--r-- | templates/admin_groups.html | 3 | ||||
-rw-r--r-- | templates/admin_ldap.html | 8 | ||||
-rw-r--r-- | templates/admin_users.html | 3 | ||||
-rw-r--r-- | templates/login.html | 7 |
6 files changed, 30 insertions, 13 deletions
@@ -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"}} <div class="d-flex"> <h4>Créer un objet</h4> - <a class="ml-auto btn btn-info" href="/">Retour</a> + <a class="ml-auto btn btn-info" href="/">Menu principal</a> </div> <div class="mt-4"> @@ -36,7 +36,7 @@ </div> <div class="form-group"> <label for="idtype">Type d'identifiant:</label> - <input type="text" id="idtype" name="idtype" class="form-control" value="{{ .IdType }}" /> + <input type="text" {{if .IsTemplated}}disabled="disabled"{{end}} id="idtype" name="idtype" class="form-control" value="{{ .IdType }}" /> </div> <div class="form-group"> <label for="displayname">Nom:</label> @@ -44,11 +44,11 @@ </div> <div class="form-group"> <label for="soc">StructuralObjectClass:</label> - <input type="text" id="soc" name="soc" class="form-control" value="{{ .StructuralObjectClass }}" /> + <input type="text" {{if .IsTemplated}}disabled="disabled"{{end}} id="soc" name="soc" class="form-control" value="{{ .StructuralObjectClass }}" /> </div> <div class="form-group"> <label for="oc">ObjectClass:</label> - <textarea rows="5" id="oc" name="oc" class="form-control">{{ .ObjectClass }}</textarea> + <textarea rows="5" {{if .IsTemplated}}disabled="disabled"{{end}} id="oc" name="oc" class="form-control">{{ .ObjectClass }}</textarea> </div> <button type="submit" class="btn btn-primary">Créer l'objet</button> </form> 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 @@ <div class="d-flex"> <h4>Liste des groupes</h4> - <a class="ml-auto btn btn-info" href="/">Retour</a> + <a class="ml-auto btn btn-success" href="/admin/create/group/{{.GroupBaseDN}}">Nouveau groupe</a> + <a class="ml-4 btn btn-info" href="/">Menu principal</a> </div> <table class="table mt-4"> 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 @@ <div class="d-flex"> <h4>Explorateur LDAP</h4> - <a class="ml-auto btn btn-info" href="/">Retour</a> + <a class="ml-auto btn btn-info" href="/">Menu principal</a> </div> <div class="mt-4"> @@ -37,12 +37,10 @@ </table> {{if .CanAddChild}} - <div class="mt-4"> - <div class="d-flex"> - <a class="ml-auto btn btn-sm btn-success" href="/admin/create/user/{{.DN}}">+utilisateur</a> + <div class="mt-2"> + <a class="btn btn-sm btn-success" href="/admin/create/user/{{.DN}}">+utilisateur</a> <a class="ml-4 btn btn-sm btn-success" href="/admin/create/group/{{.DN}}">+groupe</a> <a class="ml-4 btn btn-sm btn-success" href="/admin/create/generic/{{.DN}}">+objet</a> - </div> </div> <hr class="mt-4" /> {{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 @@ <div class="d-flex"> <h4>Liste des utilisateurs</h4> - <a class="ml-auto btn btn-info" href="/">Retour</a> + <a class="ml-auto btn btn-success" href="/admin/create/user/{{.UserBaseDN}}">Nouvel utilisateur</a> + <a class="ml-4 btn btn-info" href="/">Menu principal</a> </div> <table class="table mt-4"> 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 @@ </div> <button type="submit" class="btn btn-primary">Se connecter</button> </form> + +<hr class="mt-4" /> + +<p><strong>Mot de passe oublié ?</strong> + Écrivez à <code>coucou at deuxfleurs point fr</code> + ou contactez directement votre administrateur favori.</p> + {{end}} |