Skip to content
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

Restoring Deleted Applications #1121

Closed
adamsondelacruz opened this issue Aug 7, 2019 · 7 comments · Fixed by #3739
Closed

Restoring Deleted Applications #1121

adamsondelacruz opened this issue Aug 7, 2019 · 7 comments · Fixed by #3739
Labels
c/identity server This is related to the Identity Server compat/api This could affect API compatibility duplicate This issue or pull request already exists

Comments

@adamsondelacruz
Copy link

Summary

When you delete an application and decides to add it back, if fails because it complains that the ID already exists.

Steps to Reproduce

  1. Remove existing application
  2. Add it back using CLI or
  3. Add it back using API

What do you see now?

{
    "code": 6,
    "message": "error:pkg/identityserver/store:id_taken (ID already taken)",
    "details": [
        {
            "@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
            "namespace": "pkg/identityserver/store",
            "name": "id_taken",
            "message_format": "ID already taken",
            "correlation_id": "e68a49d8b874408d97c8c57b15b0838e"
        }
    ]
}

What do you want to see instead?

Successfullly add back the application

Environment

amazon linux using TTN CLI and Postman using API Call

How do you propose to implement this?

When user try to insert a deleted application, update the deleted flag to false

Can you do this yourself and submit a Pull Request?

...

@htdvisser htdvisser added the c/identity server This is related to the Identity Server label Aug 7, 2019
@htdvisser htdvisser added this to the Backlog milestone Aug 7, 2019
@htdvisser
Copy link
Contributor

Related to #1120

@htdvisser
Copy link
Contributor

We'd also need to check if

  1. the caller is a user or organization (not an application API key)
  2. the caller was previously a member of the entity
  3. the caller had sufficient rights on the entity (perhaps make RIGHT_APPLICATION_DELETE also restore)

When restoring the application, we should also consider that the deleted application may have had other members and API keys associated to it. The caller will need to indicate what to do with those, so this may actually require a dedicated API call.

@htdvisser htdvisser added the compat/api This could affect API compatibility label Aug 7, 2019
@htdvisser htdvisser changed the title Adding back deleted application not working Restoring Deleted Applications Aug 7, 2019
@htdvisser
Copy link
Contributor

Turns out we already have another issue for this: #604

@htdvisser
Copy link
Contributor

Looks like I forgot to close this issue before. This is being tracked in #604.

@htdvisser
Copy link
Contributor

This is implemented, and will land in v3.12.

@tomascharad
Copy link

tomascharad commented May 29, 2021

This is happening to me, but for a gateway.

https://nam1.cloud.thethings.network/console/gateways/add

image

@htdvisser
Copy link
Contributor

htdvisser commented May 31, 2021

This is an expected error if a regular user removed a gateway and then a user tries to register a gateway with the same ID.

When deleting a gateway, the EUI is released, but the ID remains reserved. See also https://www.thethingsindustries.com/docs/reference/id-eui-constraints/#deleted-entities

Only when an admin user "purges" the gateway, the ID is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/identity server This is related to the Identity Server compat/api This could affect API compatibility duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants