Make some values non deletable
This commit is contained in:
parent
b194b5f7eb
commit
61a76f624d
9
admin.go
9
admin.go
@ -164,6 +164,7 @@ type PropValues struct {
|
||||
Name string
|
||||
Values []string
|
||||
Editable bool
|
||||
Deletable bool
|
||||
}
|
||||
|
||||
func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
|
||||
@ -342,10 +343,18 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
|
||||
break
|
||||
}
|
||||
}
|
||||
deletable := true
|
||||
for _, restricted := range []string{ "displayname", "objectclass", "structuralobjectclass" } {
|
||||
if strings.EqualFold(attr.Name, restricted) {
|
||||
deletable = false
|
||||
break
|
||||
}
|
||||
}
|
||||
props[name_lower] = &PropValues{
|
||||
Name: attr.Name,
|
||||
Values: attr.Values,
|
||||
Editable: editable,
|
||||
Deletable: deletable,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,11 +76,13 @@
|
||||
</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>
|
||||
{{if $value.Deletable}}
|
||||
<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>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
Loading…
Reference in New Issue
Block a user