fix: calendar heatmap permissions (#30310)

This commit is contained in:
Daniel Dietzler
2026-07-28 11:33:10 +02:00
committed by GitHub
parent cf213c81e3
commit 6c86d39f6d
3 changed files with 18 additions and 1 deletions
@@ -358,6 +358,22 @@ describe('/admin/users', () => {
});
});
describe('GET /admin/users/:id/calendar-heatmap', () => {
it('should require authentication', async () => {
const { status, body } = await request(app).get(`/admin/users/${nonAdmin.userId}/calendar-heatmap`);
expect(status).toBe(401);
expect(body).toEqual(errorDto.unauthorized);
});
it('should require admin permissions', async () => {
const { status, body } = await request(app)
.get(`/admin/users/${nonAdmin.userId}/calendar-heatmap`)
.set('Authorization', `Bearer ${nonAdmin.accessToken}`);
expect(status).toBe(403);
expect(body).toEqual(errorDto.forbidden);
});
});
describe('POST /admin/users/:id/restore', () => {
it('should require authentication', async () => {
const { status, body } = await request(app).post(`/admin/users/${userToDelete.userId}/restore`);
+1
View File
@@ -1639,6 +1639,7 @@
"tags": [
"Users (admin)"
],
"x-immich-admin-only": true,
"x-immich-history": [
{
"version": "v3",
@@ -102,7 +102,7 @@ export class UserAdminController {
}
@Get(':id/calendar-heatmap')
@Authenticated({ permission: Permission.UserRead })
@Authenticated({ permission: Permission.UserRead, admin: true })
@Endpoint({
summary: 'Retrieve calendar heatmap activity',
description: 'Retrieve activity counts for a specified period, in a calendar heatmap format.',