TheThingsNetwork / lorawan-stack

The Things Stack, an Open Source LoRaWAN Network Server
https://www.thethingsindustries.com/stack/
Apache License 2.0
980 stars 309 forks source link

Cannot restore/purge gateways if they have been deleted #4864

Closed mikkp17 closed 2 years ago

mikkp17 commented 2 years ago

Summary

Administrators cannot release/purge or restore gateway IDs in the console if they have been deleted by other users or through API, even though they show up under "Deleted (Admin)". The EUI is released correctly. When trying to restore or purge, the server makes a request to api/v3/gateways/{gateway_id}/rights, which returns 404.

Steps to Reproduce

  1. Create a gateway using API or console
  2. Delete the gateway using API or console (and not purging it here)
  3. Go into Gateways section, click on "Deleted (Admin)"
  4. See list of deleted gateways, click either "Restore" or "Purge"
  5. Server returns 404 on api/v3/gateways/{gateway_id}/rights

The service is expected to either restore or purge here. If deleting a gateway manually as admin, and ticking the option to purge ID, it works as expected.

What is already there? What do you see now?

Selecting to purge when deleting gateway works as expected. Choosing to purge after gateway has been deleted returns 404, due to gateway rights returning 404.

Screenshot of deleted gateway: Screenshot 2021-11-12 at 10 50 36

Clicking purge makes website load forever with "Fetching data..." Screenshot of request when clicking purge: Screenshot 2021-11-12 at 10 51 37

What is missing? What do you want to see?

Gateway should be restored or purged.

Environment

How do you propose to implement this?

  1. Allow rights lookup to find these deleted items, and check rights for those (admin only maybe?) or
  2. Change the way these deleted devices restore/purge are handled, and remove the rights lookup

Can you do this yourself and submit a Pull Request?

No. ...

kschiffer commented 2 years ago

Thanks for reporting @mikkp17. This issue has been closed by the latest release 3.16.0. If you see any issues still, please reopen.