mirror of
https://github.com/immich-app/immich.git
synced 2026-02-04 08:49:01 +03:00
fix: add scoped API permissions to map endpoints (#25423)
This commit is contained in:
6
mobile/openapi/lib/model/permission.dart
generated
6
mobile/openapi/lib/model/permission.dart
generated
@@ -82,6 +82,8 @@ class Permission {
|
|||||||
static const timelinePeriodRead = Permission._(r'timeline.read');
|
static const timelinePeriodRead = Permission._(r'timeline.read');
|
||||||
static const timelinePeriodDownload = Permission._(r'timeline.download');
|
static const timelinePeriodDownload = Permission._(r'timeline.download');
|
||||||
static const maintenance = Permission._(r'maintenance');
|
static const maintenance = Permission._(r'maintenance');
|
||||||
|
static const mapPeriodRead = Permission._(r'map.read');
|
||||||
|
static const mapPeriodSearch = Permission._(r'map.search');
|
||||||
static const memoryPeriodCreate = Permission._(r'memory.create');
|
static const memoryPeriodCreate = Permission._(r'memory.create');
|
||||||
static const memoryPeriodRead = Permission._(r'memory.read');
|
static const memoryPeriodRead = Permission._(r'memory.read');
|
||||||
static const memoryPeriodUpdate = Permission._(r'memory.update');
|
static const memoryPeriodUpdate = Permission._(r'memory.update');
|
||||||
@@ -238,6 +240,8 @@ class Permission {
|
|||||||
timelinePeriodRead,
|
timelinePeriodRead,
|
||||||
timelinePeriodDownload,
|
timelinePeriodDownload,
|
||||||
maintenance,
|
maintenance,
|
||||||
|
mapPeriodRead,
|
||||||
|
mapPeriodSearch,
|
||||||
memoryPeriodCreate,
|
memoryPeriodCreate,
|
||||||
memoryPeriodRead,
|
memoryPeriodRead,
|
||||||
memoryPeriodUpdate,
|
memoryPeriodUpdate,
|
||||||
@@ -429,6 +433,8 @@ class PermissionTypeTransformer {
|
|||||||
case r'timeline.read': return Permission.timelinePeriodRead;
|
case r'timeline.read': return Permission.timelinePeriodRead;
|
||||||
case r'timeline.download': return Permission.timelinePeriodDownload;
|
case r'timeline.download': return Permission.timelinePeriodDownload;
|
||||||
case r'maintenance': return Permission.maintenance;
|
case r'maintenance': return Permission.maintenance;
|
||||||
|
case r'map.read': return Permission.mapPeriodRead;
|
||||||
|
case r'map.search': return Permission.mapPeriodSearch;
|
||||||
case r'memory.create': return Permission.memoryPeriodCreate;
|
case r'memory.create': return Permission.memoryPeriodCreate;
|
||||||
case r'memory.read': return Permission.memoryPeriodRead;
|
case r'memory.read': return Permission.memoryPeriodRead;
|
||||||
case r'memory.update': return Permission.memoryPeriodUpdate;
|
case r'memory.update': return Permission.memoryPeriodUpdate;
|
||||||
|
|||||||
@@ -6305,6 +6305,7 @@
|
|||||||
"state": "Stable"
|
"state": "Stable"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"x-immich-permission": "map.read",
|
||||||
"x-immich-state": "Stable"
|
"x-immich-state": "Stable"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -6376,6 +6377,7 @@
|
|||||||
"state": "Stable"
|
"state": "Stable"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"x-immich-permission": "map.search",
|
||||||
"x-immich-state": "Stable"
|
"x-immich-state": "Stable"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -18966,6 +18968,8 @@
|
|||||||
"timeline.read",
|
"timeline.read",
|
||||||
"timeline.download",
|
"timeline.download",
|
||||||
"maintenance",
|
"maintenance",
|
||||||
|
"map.read",
|
||||||
|
"map.search",
|
||||||
"memory.create",
|
"memory.create",
|
||||||
"memory.read",
|
"memory.read",
|
||||||
"memory.update",
|
"memory.update",
|
||||||
|
|||||||
@@ -5534,6 +5534,8 @@ export enum Permission {
|
|||||||
TimelineRead = "timeline.read",
|
TimelineRead = "timeline.read",
|
||||||
TimelineDownload = "timeline.download",
|
TimelineDownload = "timeline.download",
|
||||||
Maintenance = "maintenance",
|
Maintenance = "maintenance",
|
||||||
|
MapRead = "map.read",
|
||||||
|
MapSearch = "map.search",
|
||||||
MemoryCreate = "memory.create",
|
MemoryCreate = "memory.create",
|
||||||
MemoryRead = "memory.read",
|
MemoryRead = "memory.read",
|
||||||
MemoryUpdate = "memory.update",
|
MemoryUpdate = "memory.update",
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
MapReverseGeocodeDto,
|
MapReverseGeocodeDto,
|
||||||
MapReverseGeocodeResponseDto,
|
MapReverseGeocodeResponseDto,
|
||||||
} from 'src/dtos/map.dto';
|
} from 'src/dtos/map.dto';
|
||||||
import { ApiTag } from 'src/enum';
|
import { ApiTag, Permission } from 'src/enum';
|
||||||
import { Auth, Authenticated } from 'src/middleware/auth.guard';
|
import { Auth, Authenticated } from 'src/middleware/auth.guard';
|
||||||
import { MapService } from 'src/services/map.service';
|
import { MapService } from 'src/services/map.service';
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ export class MapController {
|
|||||||
constructor(private service: MapService) {}
|
constructor(private service: MapService) {}
|
||||||
|
|
||||||
@Get('markers')
|
@Get('markers')
|
||||||
@Authenticated()
|
@Authenticated({ permission: Permission.MapRead })
|
||||||
@Endpoint({
|
@Endpoint({
|
||||||
summary: 'Retrieve map markers',
|
summary: 'Retrieve map markers',
|
||||||
description: 'Retrieve a list of latitude and longitude coordinates for every asset with location data.',
|
description: 'Retrieve a list of latitude and longitude coordinates for every asset with location data.',
|
||||||
@@ -28,8 +28,8 @@ export class MapController {
|
|||||||
return this.service.getMapMarkers(auth, options);
|
return this.service.getMapMarkers(auth, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Authenticated()
|
|
||||||
@Get('reverse-geocode')
|
@Get('reverse-geocode')
|
||||||
|
@Authenticated({ permission: Permission.MapSearch })
|
||||||
@HttpCode(HttpStatus.OK)
|
@HttpCode(HttpStatus.OK)
|
||||||
@Endpoint({
|
@Endpoint({
|
||||||
summary: 'Reverse geocode coordinates',
|
summary: 'Reverse geocode coordinates',
|
||||||
|
|||||||
@@ -160,6 +160,9 @@ export enum Permission {
|
|||||||
|
|
||||||
Maintenance = 'maintenance',
|
Maintenance = 'maintenance',
|
||||||
|
|
||||||
|
MapRead = 'map.read',
|
||||||
|
MapSearch = 'map.search',
|
||||||
|
|
||||||
MemoryCreate = 'memory.create',
|
MemoryCreate = 'memory.create',
|
||||||
MemoryRead = 'memory.read',
|
MemoryRead = 'memory.read',
|
||||||
MemoryUpdate = 'memory.update',
|
MemoryUpdate = 'memory.update',
|
||||||
|
|||||||
Reference in New Issue
Block a user