mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 09:12:57 +02:00
feat(server): granular permissions for api keys (#11824)
feat(server): api auth permissions
This commit is contained in:
parent
a372b56d44
commit
f230b3aa42
43 changed files with 817 additions and 135 deletions
e2e/src
|
@ -7,6 +7,7 @@ import {
|
|||
CreateAlbumDto,
|
||||
CreateLibraryDto,
|
||||
MetadataSearchDto,
|
||||
Permission,
|
||||
PersonCreateDto,
|
||||
SharedLinkCreateDto,
|
||||
UserAdminCreateDto,
|
||||
|
@ -279,8 +280,8 @@ export const utils = {
|
|||
});
|
||||
},
|
||||
|
||||
createApiKey: (accessToken: string) => {
|
||||
return createApiKey({ apiKeyCreateDto: { name: 'e2e' } }, { headers: asBearerAuth(accessToken) });
|
||||
createApiKey: (accessToken: string, permissions: Permission[]) => {
|
||||
return createApiKey({ apiKeyCreateDto: { name: 'e2e', permissions } }, { headers: asBearerAuth(accessToken) });
|
||||
},
|
||||
|
||||
createAlbum: (accessToken: string, dto: CreateAlbumDto) =>
|
||||
|
@ -492,7 +493,7 @@ export const utils = {
|
|||
},
|
||||
|
||||
cliLogin: async (accessToken: string) => {
|
||||
const key = await utils.createApiKey(accessToken);
|
||||
const key = await utils.createApiKey(accessToken, [Permission.All]);
|
||||
await immichCli(['login', app, `${key.secret}`]);
|
||||
return key.secret;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue