grafana-iam: change resourcepermission to use a single verb (#110263)

* `grafana-iam`: change resource permission to only allow a single action set for now

* api changes
This commit is contained in:
Gabriel MABILLE
2025-08-28 11:25:38 +02:00
committed by GitHub
parent 87fe2f4258
commit 0284c3f1f9
4 changed files with 16 additions and 28 deletions
@@ -14,8 +14,8 @@ ResourcePermission: {
kind: "User" | "ServiceAccount" | "Team" | "BasicRole"
// uid of the identity getting the permission
name: string
// list of actions granted to the user (e.g. "admin" or "get", "update")
verbs: [...string]
// action set granted to the user (e.g. "admin" or "edit", "view")
verb: string
}
resource: #Resource
@@ -23,15 +23,13 @@ type ResourcePermissionspecPermission struct {
Kind ResourcePermissionSpecPermissionKind `json:"kind"`
// uid of the identity getting the permission
Name string `json:"name"`
// list of actions granted to the user (e.g. "admin" or "get", "update")
Verbs []string `json:"verbs"`
// action set granted to the user (e.g. "admin" or "edit", "view")
Verb string `json:"verb"`
}
// NewResourcePermissionspecPermission creates a new ResourcePermissionspecPermission object.
func NewResourcePermissionspecPermission() *ResourcePermissionspecPermission {
return &ResourcePermissionspecPermission{
Verbs: []string{},
}
return &ResourcePermissionspecPermission{}
}
// +k8s:openapi-gen=true
@@ -1111,23 +1111,16 @@ func schema_pkg_apis_iam_v0alpha1_ResourcePermissionspecPermission(ref common.Re
Format: "",
},
},
"verbs": {
"verb": {
SchemaProps: spec.SchemaProps{
Description: "list of actions granted to the user (e.g. \"admin\" or \"get\", \"update\")",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
Description: "action set granted to the user (e.g. \"admin\" or \"edit\", \"view\")",
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
Required: []string{"kind", "name", "verbs"},
Required: []string{"kind", "name", "verb"},
},
},
}
@@ -4042,7 +4042,7 @@
"required": [
"kind",
"name",
"verbs"
"verb"
],
"properties": {
"kind": {
@@ -4055,13 +4055,10 @@
"type": "string",
"default": ""
},
"verbs": {
"description": "list of actions granted to the user (e.g. \"admin\" or \"get\", \"update\")",
"type": "array",
"items": {
"type": "string",
"default": ""
}
"verb": {
"description": "action set granted to the user (e.g. \"admin\" or \"edit\", \"view\")",
"type": "string",
"default": ""
}
}
},