aboutsummaryrefslogtreecommitdiff
path: root/templates/admin_ldap.html
blob: 53570fe935128916000aceca695d5fdad5723d52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
{{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>

<div class="mt-4">
  <div class="d-flex">
    <a class="ml-auto 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>

<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>

{{if .Success}}
  <div class="alert alert-success mt-2">Modification enregistrée.</div>
{{end}}
{{if .Error}}
  <div class="alert alert-danger mt-2">
    Impossible d'effectuer la modification.
    <div style="font-size: 0.8em">{{.Error}}</div>
  </div>
{{end}}

<h5>Attributs</h5>
<div class="container">
    {{range $key, $value := .Props}}
      {{if $value.Editable}}
        <div class="row mt-4">
          <div class="col-md-3"><strong>{{$value.Name}}</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>
          </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">
          <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 .HasMembers}}
  <hr class="mt-4" />
  <h5 class="mt-4">Membres</h5>
  <div class="container">
    {{range .Members}}
      <div class="row mt-4">
        <div class="col-md-3">
          <strong>{{.DisplayName}}</strong>
        </div>
        <div class="col-md-5">
          <a href="/admin/ldap/{{.DN}}">{{.DN}}</a>
        </div>
        <div class="col-md-2">
            <form method="POST" onsubmit="return confirm('Supprimer du groupe ?');">
              <input type="hidden" name="action" value="delete-member" />
              <input type="hidden" name="member" value="{{.DN}}" />
              <input type="submit" value="Supprimer" class="form-control btn btn-danger btn-sm" />
            </form>
        </div>
      </div>
    {{end}}
    <form method="POST">
      <input type="hidden" name="action" value="add" />
      <input type="hidden" name="attr" value="member" />
      <div class="row mt-4">
        <div class="col-md-3"><strong>Ajouter au groupe :</strong>
      </div>
      <div class="col-md-5">
        <input class="form-control" type="text" name="values" placeholder="Groupe..." />
      </div>
      <div class="col-md-2">
          <input type="submit" value="Ajouter" class="form-control btn btn-success btn-sm" />
      </div>
    </form>
  </div>
{{end}}

{{if .HasGroups}}
  <hr class="mt-4" />
  <h5 class="mt-4">Membre de</h5>
  <div class="container">
    {{range .Groups}}
      <div class="row mt-4">
        <div class="col-md-3">
          <strong>{{.DisplayName}}</strong>
        </div>
        <div class="col-md-5">
          <a href="/admin/ldap/{{.DN}}">{{.DN}}</a>
        </div>
        <div class="col-md-2">
            <form method="POST" onsubmit="return confirm('Supprimer du groupe ?');">
              <input type="hidden" name="action" value="delete-from-group" />
              <input type="hidden" name="group" value="{{.DN}}" />
              <input type="submit" value="Supprimer" class="form-control btn btn-danger btn-sm" />
            </form>
        </div>
      </div>
    {{end}}
    <form method="POST">
      <input type="hidden" name="action" value="add-to-group" />
      <div class="row mt-4">
        <div class="col-md-3"><strong>Nouveau groupe :</strong>
      </div>
      <div class="col-md-5">
        <input class="form-control" type="text" name="group" placeholder="Groupe..." />
      </div>
      <div class="col-md-2">
          <input type="submit" value="Ajouter" class="form-control btn btn-success btn-sm" />
      </div>
    </form>
  </div>
{{end}}

<hr class="mt-4" />

{{end}}