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

feat(web-console): add current_user info in the top bar #225

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

insmac
Copy link
Contributor

@insmac insmac commented Nov 10, 2023

Add user info next to the instance name (if available, not set on the screenshot below).

CleanShot 2023-11-10 at 10 21 03@2x

@insmac insmac added the web-console Issues relevant to "web-console" package label Nov 10, 2023
@glasstiger
Copy link
Contributor

glasstiger commented Nov 10, 2023

Will this update after every SQL command?
Just asking because if the user is logged in as my_user, and runs something like:

ASSUME SERVICE ACCOUNT my_service_account;

then my_user has to change to my_service_account.

Basically after the above SQL the user switched to the service account, and SELECT CURRENT_USER() will return the new username.

This will switch back to my_user:

EXIT SERVICE ACCOUNT my_service_account;

@glasstiger
Copy link
Contributor

not sure how it is decided when to run tables() and update the list of tables on the left panel, but maybe this could work on a similar way.

@insmac
Copy link
Contributor Author

insmac commented Nov 10, 2023

@glasstiger thanks for your input, good catch! 🥇 👍

In short - no, the current version fetches all the variables in a single query (SELECT instance_name, instance_rgb, current_user) and renders accordingly - this is on load only, but it can be modified as needed.

What I can do easily is to re-run this query once a particular type of query is run in the editor, i.e. we refresh tables() for DDL queries, this can be refreshed as well.

@glasstiger
Copy link
Contributor

"What I can do easily is to re-run this query once a particular type of query is run in the editor, i.e. we refresh tables() for DDL queries, this can be refreshed as well." -> as discussed, this seems to be a good workaround for now.

Later it is probably worth adding a new type: DCL, which would trigger access control related refreshes, such as current user or list of permissions for the current user.

@bluestreak01 bluestreak01 merged commit 4f94b39 into main Nov 13, 2023
@bluestreak01 bluestreak01 deleted the web-console/current_user branch November 13, 2023 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
web-console Issues relevant to "web-console" package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants