mirror of
https://github.com/immich-app/immich.git
synced 2026-07-28 14:47:30 -07:00
fix: calendar heatmap permissions (#30310)
This commit is contained in:
@@ -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`);
|
||||
|
||||
@@ -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.',
|
||||
|
||||
Reference in New Issue
Block a user