mirror of
https://github.com/immich-app/immich.git
synced 2026-07-28 14:47:30 -07:00
fix: calendar heatmap api key permissions (#30314)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
LoginResponseDto,
|
||||
Permission,
|
||||
QueueName,
|
||||
createStack,
|
||||
deleteUserAdmin,
|
||||
@@ -372,6 +373,15 @@ describe('/admin/users', () => {
|
||||
expect(status).toBe(403);
|
||||
expect(body).toEqual(errorDto.forbidden);
|
||||
});
|
||||
|
||||
it('should require the AdminUserRead permission', async () => {
|
||||
const { secret } = await utils.createApiKey(admin.accessToken, [Permission.UserRead]);
|
||||
const { status, body } = await request(app)
|
||||
.get(`/admin/users/${nonAdmin.userId}/calendar-heatmap`)
|
||||
.set('x-api-key', secret);
|
||||
expect(status).toBe(403);
|
||||
expect(body).toEqual(errorDto.forbidden);
|
||||
});
|
||||
});
|
||||
|
||||
describe('POST /admin/users/:id/restore', () => {
|
||||
|
||||
@@ -1650,7 +1650,7 @@
|
||||
"state": "Stable"
|
||||
}
|
||||
],
|
||||
"x-immich-permission": "user.read",
|
||||
"x-immich-permission": "adminUser.read",
|
||||
"x-immich-state": "Stable"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -102,7 +102,7 @@ export class UserAdminController {
|
||||
}
|
||||
|
||||
@Get(':id/calendar-heatmap')
|
||||
@Authenticated({ permission: Permission.UserRead, admin: true })
|
||||
@Authenticated({ permission: Permission.AdminUserRead, admin: true })
|
||||
@Endpoint({
|
||||
summary: 'Retrieve calendar heatmap activity',
|
||||
description: 'Retrieve activity counts for a specified period, in a calendar heatmap format.',
|
||||
|
||||
Reference in New Issue
Block a user