Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin API key cannot delete assets owned by other users #6788

Closed
1 of 3 tasks
shamefulIguana8 opened this issue Jan 31, 2024 · 3 comments
Closed
1 of 3 tasks

Admin API key cannot delete assets owned by other users #6788

shamefulIguana8 opened this issue Jan 31, 2024 · 3 comments

Comments

@shamefulIguana8
Copy link

The bug

Hello, I am trying to delete some orphaned assets (due to docker volume weirdness, not because of an Immich bug) using the deleteAssets api.

When I send the request:

DELETE https://[immich]/api/asset

Headers: 
Content-Type: application/json
x-api-key: [admin api key]

Body:
{
  "force": true,
  "ids": [
    "[asset owned by non-admin user]"
  ]
}

I recieve:

{
  "message": "Not found or no asset.delete access",
  "error": "Bad Request",
  "statusCode": 400
}

If I use the asset owner's API key then it works and deletes the asset successfully.

The OS that Immich Server is running on

Fedora Linux 37 (Server Edition) x86_64, Docker version 24.0.7

Version of Immich Server

v1.93.3

Version of Immich Mobile App

N/A

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

N/A

Your .env content

N/A

Reproduction steps

Send a DELETE request to https://[immich]/api/asset
Use an admin api key
Include an asset UUID owned by a different user from the admin account
Get a 400 error

Additional information

I've tested this in python with the requests library as well as with curl

I doubt this is a big issue, but it's still an inconvenience when using a script to delete all the orphaned assets as you need an admin api key to get the list of orphans and then an api key from every user matched to the assets to be deleted... Or you can just try every user api key against every asset but its still a massive pain with multiple users. (Thankfully my IDP has impersonation so I can get the various api keys)

@bo0tzz
Copy link
Member

bo0tzz commented Jan 31, 2024

This is as intended

@bo0tzz bo0tzz closed this as completed Jan 31, 2024
@shamefulIguana8
Copy link
Author

Okay, sorry for the waste of time. I couldn't find anything about it in the docs.

@aviv926
Copy link
Contributor

aviv926 commented Jan 31, 2024

This is as intended

I'm not sure how to do it from mobile but it might be worth converting it to a conversation (as answered/solved mark) until we add this information to the documentation.

@immich-app immich-app locked and limited conversation to collaborators Jan 31, 2024
@jrasm91 jrasm91 converted this issue into discussion #6804 Jan 31, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants