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

Fix default builtin group being associated twice with imported users #98

Merged
merged 3 commits into from
Oct 27, 2021

Conversation

wtfzambo
Copy link
Collaborator

Fixes #96.

Also adds a progress bar to the operation and some minor polishing.

Also:

- Add a progress bar to the operation
- Add setting to `meta.json` to easily retrieve `destination_admin_user_id`
- Make `destination_admin_user_id` of `int` type in `meta.json`
- Minor polishings
Co-authored-by: Restyled.io <[email protected]>
Copy link
Collaborator

@susodapop susodapop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good. Since we don't have progress meters for any other operations, I would rather not introduce the complexity here. It might lead users to believe that the other commands are somehow broken.

Can we split this into a separate PR and implement it for all the commands?

@wtfzambo
Copy link
Collaborator Author

The only reason I made the progress bar is because there's not API to delete members in batch for any given group. So I had to use the api/groups/dest_id/members/member_id endpoint and make a DELETE request for every member_id found in the group.

I didn't want to show an operation for each row like it happens for every other command, because it didn't make sense in this case, but on the other hand, if one has many members (for example, my instance has 83) it can take a while, thus I added the progress bar to show the user that the script is not stuck and it's doing its job.

If you want to add it for every command, what should we do with the current print operations? In terms of user experience I don't see the progress bar being compatible with them, since for each id of something being exported, a new line is printed.

@wtfzambo
Copy link
Collaborator Author

wtfzambo commented Oct 26, 2021

@susodapop
I could maybe try implementing something like this, if it's to your liking (but without using external packages). Although for the "Preparing builtin group {dest_id} to restore original members associations..." operation I still would skip printing each DELETE operation. Up to suggestions tbh.

print-hook

Copy link
Collaborator

@susodapop susodapop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You convinced me 👍

Tested this against the latest redash V10 image (10.0.0 (9c928bd1)) and all works.

@susodapop susodapop merged commit 177240d into master Oct 27, 2021
@susodapop susodapop deleted the fix_double_default_in_members branch October 27, 2021 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent double association of default group when importing users
2 participants