mirror of
https://github.com/niusmallnan/steve.git
synced 2025-06-29 16:06:56 +00:00
Add blocked links for update and remove if method is disallowed
This commit is contained in:
parent
d9512c366d
commit
bcbcef36b3
@ -73,6 +73,14 @@ func formatter(summarycache *summarycache.SummaryCache) types.Formatter {
|
|||||||
resource.Links["update"] = u
|
resource.Links["update"] = u
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, ok := resource.Links["update"]; !ok && slice.ContainsString(resource.Schema.ResourceMethods, "blocked-PUT") {
|
||||||
|
resource.Links["update"] = "blocked"
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, ok := resource.Links["remove"]; !ok && slice.ContainsString(resource.Schema.ResourceMethods, "blocked-DELETE") {
|
||||||
|
resource.Links["remove"] = "blocked"
|
||||||
|
}
|
||||||
|
|
||||||
if unstr, ok := resource.APIObject.Object.(*unstructured.Unstructured); ok {
|
if unstr, ok := resource.APIObject.Object.(*unstructured.Unstructured); ok {
|
||||||
s, rel := summarycache.SummaryAndRelationship(unstr)
|
s, rel := summarycache.SummaryAndRelationship(unstr)
|
||||||
data.PutValue(unstr.Object, map[string]interface{}{
|
data.PutValue(unstr.Object, map[string]interface{}{
|
||||||
|
Loading…
Reference in New Issue
Block a user