feat: add external id for users #3219
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds an optional
external_idfield to each user account. This means other systems can set this field for the LNbits users and then it can query by it.The
external_idcan have max 256 characters without space or new line characters. The value can be seen by a user, but a regular user cannot update its ownexternal_id, only admins are allowed.It is ALLOWED for more users to have the SAME external id. This allows third party systems to have a
one-to-oneor aone-to-manyrelation between their users and LNbits users.It can be set/updated via the Admin UI or via the API.
Admin UI
API call
See API test: test_update_user_success
external_id, this is allowed{ "data": [ { "id": "a8f1abc9c1ec4000ab2df560789963bd", "external_id": "external_id_two", "username": "admin", "extra": {...}, ... }, { "id": "edc30a66312543c0a1df5a10ca094111", "external_id": "external_id_two", "extra": {...}, ... } ], "total": 2 }