mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-09 01:17:06 +02:00
fix: consider ADMIN in API tokens fetch permissions (#4032)
https://github.com/Unleash/unleash/pull/4019 introduced a bug where API token filtering was not taking into account ADMIN permissions, which means the API tokens were not being displayed on the UI.
This commit is contained in:
parent
35d323aea7
commit
197df96ff4
@ -353,13 +353,16 @@ export class ApiTokenController extends Controller {
|
|||||||
const userPermissions = await this.accessService.getPermissionsForUser(
|
const userPermissions = await this.accessService.getPermissionsForUser(
|
||||||
user,
|
user,
|
||||||
);
|
);
|
||||||
let allowedTokenTypes = [
|
|
||||||
|
const allowedTokenTypes = [
|
||||||
READ_ADMIN_API_TOKEN,
|
READ_ADMIN_API_TOKEN,
|
||||||
READ_CLIENT_API_TOKEN,
|
READ_CLIENT_API_TOKEN,
|
||||||
READ_FRONTEND_API_TOKEN,
|
READ_FRONTEND_API_TOKEN,
|
||||||
]
|
]
|
||||||
.filter((readPerm) =>
|
.filter((readPerm) =>
|
||||||
userPermissions.some((p) => p.permission === readPerm),
|
userPermissions.some(
|
||||||
|
(p) => p.permission === readPerm || p.permission === ADMIN,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.map(permissionToTokenType)
|
.map(permissionToTokenType)
|
||||||
.filter((t) => t);
|
.filter((t) => t);
|
||||||
|
Loading…
Reference in New Issue
Block a user