UserStorage: Improve error handling (#104025)

This commit is contained in:
Andres Martinez Gotor
2025-04-15 15:32:46 +02:00
committed by GitHub
parent aacac86811
commit e93fc9c003
4 changed files with 55 additions and 21 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ func (b *UserStorageAPIBuilder) GetAuthorizer() authorizer.Authorizer {
switch attr.GetVerb() {
case "create":
// Create requests are validated later since we don't have access to the resource name
return authorizer.DecisionNoOpinion, "", nil
return authorizer.DecisionAllow, "", nil
case "get", "delete", "patch", "update":
// Only allow the user to access their own settings
if !compareResourceNameAndUserUID(attr.GetName(), u) {
@@ -43,7 +43,7 @@ func TestAuthorizer(t *testing.T) {
requesterID: "123",
objectName: "",
verb: "create",
decision: authorizer.DecisionNoOpinion,
decision: authorizer.DecisionAllow,
},
{
name: "forbidden action",