Make some values non deletable
This commit is contained in:
parent
b194b5f7eb
commit
61a76f624d
2 changed files with 16 additions and 5 deletions
9
admin.go
9
admin.go
|
@ -164,6 +164,7 @@ type PropValues struct {
|
||||||
Name string
|
Name string
|
||||||
Values []string
|
Values []string
|
||||||
Editable bool
|
Editable bool
|
||||||
|
Deletable bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
|
func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -342,10 +343,18 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
deletable := true
|
||||||
|
for _, restricted := range []string{ "displayname", "objectclass", "structuralobjectclass" } {
|
||||||
|
if strings.EqualFold(attr.Name, restricted) {
|
||||||
|
deletable = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
props[name_lower] = &PropValues{
|
props[name_lower] = &PropValues{
|
||||||
Name: attr.Name,
|
Name: attr.Name,
|
||||||
Values: attr.Values,
|
Values: attr.Values,
|
||||||
Editable: editable,
|
Editable: editable,
|
||||||
|
Deletable: deletable,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,11 +76,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-1">
|
<div class="col-md-1">
|
||||||
<form method="POST" onsubmit="return confirm('Supprimer cet attribut ?');">
|
{{if $value.Deletable}}
|
||||||
<input type="hidden" name="action" value="delete" />
|
<form method="POST" onsubmit="return confirm('Supprimer cet attribut ?');">
|
||||||
<input type="hidden" name="attr" value="{{$key}}" />
|
<input type="hidden" name="action" value="delete" />
|
||||||
<input type="submit" value="Suppr." class="form-control btn btn-danger btn-sm" />
|
<input type="hidden" name="attr" value="{{$key}}" />
|
||||||
</form>
|
<input type="submit" value="Suppr." class="form-control btn btn-danger btn-sm" />
|
||||||
|
</form>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in a new issue