Skip to content

Commit d7cebe5

Browse files
committed
REST: Rename permission denied "reason" to "denial_reason"
Bug: T366581 Change-Id: I24b483630f60705b91eec8f24d688274e122876e
1 parent 4ff784f commit d7cebe5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

repo/rest-api/src/Application/UseCases/UseCaseError.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class UseCaseError extends UseCaseException {
5959
public const CONTEXT_PARAMETER = 'parameter';
6060
public const CONTEXT_PATH = 'path';
6161
public const CONTEXT_PROPERTY_ID = 'property_id';
62-
public const CONTEXT_REASON = 'reason';
62+
public const CONTEXT_DENIAL_REASON = 'denial_reason';
6363
public const CONTEXT_REDIRECT_TARGET = 'redirect_target';
6464
public const CONTEXT_RESOURCE_TYPE = 'resource_type';
6565
public const CONTEXT_SITE_ID = 'site_id';
@@ -96,7 +96,7 @@ class UseCaseError extends UseCaseException {
9696
self::CONTEXT_STATEMENT_GROUP_PROPERTY_ID,
9797
self::CONTEXT_STATEMENT_PROPERTY_ID,
9898
],
99-
self::PERMISSION_DENIED => [ self::CONTEXT_REASON ],
99+
self::PERMISSION_DENIED => [ self::CONTEXT_DENIAL_REASON ],
100100
self::PERMISSION_DENIED_UNKNOWN_REASON => [],
101101
self::PROPERTY_STATEMENT_ID_MISMATCH => [ self::CONTEXT_PROPERTY_ID, self::CONTEXT_STATEMENT_ID ],
102102
self::REFERENCED_RESOURCE_NOT_FOUND => [ self::CONTEXT_PATH ],
@@ -213,7 +213,7 @@ public static function newPatchResultModifiedReadOnlyValue( string $path ): self
213213
}
214214

215215
public static function newPermissionDenied( string $reason ): self {
216-
return new self( self::PERMISSION_DENIED, 'Access to resource is denied', [ self::CONTEXT_REASON => $reason ] );
216+
return new self( self::PERMISSION_DENIED, 'Access to resource is denied', [ self::CONTEXT_DENIAL_REASON => $reason ] );
217217
}
218218

219219
public static function newResourceNotFound( string $resourceType ): self {

repo/rest-api/tests/mocha/api-testing/AuthTest.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describeWithTestData( 'Auth', ( itemRequestInputs, propertyRequestInputs, descri
7272
await newRequestBuilder().withJsonBodyParam( 'bot', true ).makeRequest(),
7373
403,
7474
'permission-denied',
75-
{ reason: 'unauthorized-bot-edit' }
75+
{ denial_reason: 'unauthorized-bot-edit' }
7676
);
7777
} );
7878
}
@@ -101,7 +101,7 @@ describeWithTestData( 'Auth', ( itemRequestInputs, propertyRequestInputs, descri
101101
await newRequestBuilder().withUser( user ).makeRequest(),
102102
403,
103103
'permission-denied',
104-
{ reason: 'blocked-user' }
104+
{ denial_reason: 'blocked-user' }
105105
);
106106
} );
107107
} );
@@ -128,7 +128,7 @@ describeWithTestData( 'Auth', ( itemRequestInputs, propertyRequestInputs, descri
128128
await newRequestBuilder().makeRequest(),
129129
403,
130130
'permission-denied',
131-
{ reason: 'resource-protected' }
131+
{ denial_reason: 'resource-protected' }
132132
);
133133
} );
134134
} );

0 commit comments

Comments
 (0)