diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/admin_groups.html | 31 | ||||
-rw-r--r-- | templates/admin_ldap.html | 134 | ||||
-rw-r--r-- | templates/admin_users.html | 8 | ||||
-rw-r--r-- | templates/home.html | 2 |
4 files changed, 172 insertions, 3 deletions
diff --git a/templates/admin_groups.html b/templates/admin_groups.html new file mode 100644 index 0000000..8b5a4ef --- /dev/null +++ b/templates/admin_groups.html @@ -0,0 +1,31 @@ +{{define "title"}}Liste des groupes |{{end}} + +{{define "body"}} + +<div class="d-flex"> + <h4>Liste des groupes</h4> + <a class="ml-auto btn btn-info" href="/">Retour</a> +</div> + +<table class="table mt-4"> + <thead> + <th scope="col">Identifiant</th> + <th scope="col">Nom complet</th> + </thead> + <tbody> + {{with $root := .}} + {{range $group := $root.Groups}} + <tr> + <td> + <a href="/admin/ldap/{{$group.DN}}"> + {{$group.GetAttributeValue $root.GroupNameAttr}} + </a> + </td> + <td>{{$group.GetAttributeValue "displayname"}}</td> + </tr> + {{end}} + {{end}} + </tbody> +</table> + +{{end}} diff --git a/templates/admin_ldap.html b/templates/admin_ldap.html new file mode 100644 index 0000000..5eece8a --- /dev/null +++ b/templates/admin_ldap.html @@ -0,0 +1,134 @@ +{{define "title"}}Explorateur LDAP |{{end}} + +{{define "body"}} + +<div class="d-flex"> + <h4>Explorateur LDAP</h4> + <a class="ml-auto btn btn-info" href="/">Retour</a> +</div> + +<div class="mt-4"> + <nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + {{range .Path}} + {{if .Active}} + <li class="breadcrumb-item active" aria-current="page">{{.Identifier}}</li> + {{else}} + <li class="breadcrumb-item"><a href="/admin/ldap/{{.DN}}">{{.Identifier}}</a></li> + {{end}} + {{end}} + </ol> + </nav> +</div> + +<table class="table mt-4"> + <tbody> + {{range .Children}} + <tr> + <td> + <a href="/admin/ldap/{{.DN}}"> + {{.Identifier}} + </a> + </td> + <td>{{.DisplayName}}</td> + </tr> + {{end}} + </tbody> +</table> + +<h5>Attributs</h5> +<div class="container"> + {{range $key, $value := .Props}} + {{if $value.Editable}} + <div class="row mt-4"> + <div class="col-md-3"><strong>{{$key}}</strong></div> + + <div class="col-md-7"> + <form method="POST"> + <div class="form-row"> + <input type="hidden" name="action" value="modify" /> + <input type="hidden" name="attr" value="{{$key}}" /> + <textarea name="values" rows="{{len $value.Values}}" class="form-control col-md-9">{{range $i, $x := $value.Values}}{{if $i}}{{"\n"}}{{end}}{{$x}}{{end}}</textarea> + <div class="col-md-3"> + <input type="submit" value="Modifier" class="form-control btn btn-primary" /> + </div> + </div> + </form> + {{if $value.ModifySuccess}} + <div class="alert alert-success mt-2">Modification enregistrée.</div> + {{end}} + {{if $value.ModifyError}} + <div class="alert alert-danger mt-2"> + Impossible de modifier la valeur. + <div style="font-size: 0.8em">{{$value.ModifyError}}</div> + </div> + {{end}} + </div> + + <div class="col-md-1"> + <form method="POST" onsubmit="return confirm('Supprimer cet attribut ?');"> + <input type="hidden" name="action" value="delete" /> + <input type="hidden" name="attr" value="{{$key}}" /> + <input type="submit" value="Suppr." class="form-control btn btn-danger btn-sm" /> + </form> + </div> + </div> + {{end}} + {{end}} + {{range $key, $value := .Props}} + {{if not $value.Editable}} + <div class="row mt-4"> + <div class="col-md-3"><strong>{{$key}}</strong></div> + <div class="col-md-9"> + {{range $value.Values}} + <div>{{.}}</div> + {{end}} + </div> + </div> + {{end}} + {{end}} + <form method="POST"> + <div class="row mt-4"> + <div class="col-md-3"> + <input type="hidden" name="action" value="add" /> + <input class="form-control" type="text" name="attr" placeholder="Ajouter un attribut..." /> + </div> + <div class="col-md-7"> + {{if .AddError}} + <div class="alert alert-danger"> + Impossible d'ajouter la valeur. + <div style="font-size: 0.8em">{{.AddError}}</div> + </div> + {{end}} + <div class="form-row"> + <textarea name="values" placeholder="Valeur(s)..." rows="2" class="form-control col-md-9"></textarea> + <div class="col-md-3"> + <input type="submit" value="Ajouter" class="form-control btn btn-success" /> + </div> + </div> + </div> + </div> + </form> +</div> + +{{if .Members}} + <h5 class="mt-4">Membres</h5> + <ul class="list-group"> + {{range .Members}} + <li class="list-group-item">{{.}}</li> + {{end}} + </ul> +{{end}} + +{{if .Groups}} + <h5 class="mt-4">Membre de</h5> + <ul class="list-group"> + {{range .Groups}} + <li class="list-group-item">{{.}}</li> + {{end}} + </ul> +{{end}} + +<hr class="mt-4" /> + +{{end}} diff --git a/templates/admin_users.html b/templates/admin_users.html index 39e291c..01d96d2 100644 --- a/templates/admin_users.html +++ b/templates/admin_users.html @@ -9,7 +9,7 @@ <table class="table mt-4"> <thead> - <th scope="col">{{ .UserNameAttr }}</th> + <th scope="col">Identifiant</th> <th scope="col">Nom complet</th> <th scope="col">Email</th> </thead> @@ -17,7 +17,11 @@ {{with $root := .}} {{range $user := $root.Users}} <tr> - <td>{{$user.GetAttributeValue $root.UserNameAttr}}</td> + <td> + <a href="/admin/ldap/{{$user.DN}}"> + {{$user.GetAttributeValue $root.UserNameAttr}} + </a> + </td> <td>{{$user.GetAttributeValue "displayname"}}</td> <td>{{$user.GetAttributeValue "mail"}}</td> </tr> diff --git a/templates/home.html b/templates/home.html index b4012fd..011dcc1 100644 --- a/templates/home.html +++ b/templates/home.html @@ -30,7 +30,7 @@ <div class="list-group list-group-flush"> <a class="list-group-item list-group-item-action" href="/admin/users">Utilisateurs</a> <a class="list-group-item list-group-item-action" href="/admin/groups">Groupes</a> - <a class="list-group-item list-group-item-action" href="/admin/ldap">Explorateur LDAP</a> + <a class="list-group-item list-group-item-action" href="/admin/ldap/{{.BaseDN}}">Explorateur LDAP</a> </div> </div> {{end}} |