1
0
mirror of https://github.com/rancher/steve.git synced 2025-04-28 03:10:32 +00:00

[v0.4] Add schema links and resource methods for resource verb patch (#450)

* Show patch link on the API resource when patch permission is present and add patch ResourceMethod to the schema.

* Added tests for new functionality and corrected disallowed method for patch
# Conflicts:
#	pkg/resources/common/formatter.go
#	pkg/resources/common/formatter_test.go
This commit is contained in:
Chad Roberts 2025-04-25 05:28:12 -04:00
parent 79e262c201
commit 25ea0e02c4
No known key found for this signature in database
GPG Key ID: 1F6B1A7A4D54C39A

View File

@ -131,10 +131,6 @@ func formatter(summarycache *summarycache.SummaryCache, asl accesscontrol.Access
delete(resource.Links, "patch")
}
if _, ok := resource.Links["patch"]; !ok && slice.ContainsString(resource.Schema.ResourceMethods, "blocked-PATCH") {
resource.Links["patch"] = "blocked"
}
if unstr, ok := resource.APIObject.Object.(*unstructured.Unstructured); ok {
// with the sql cache, these were already added by the indexer. However, the sql cache
// is only used for lists, so we need to re-add here for get/watch