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
Allow user to connect without database #1884
base: master
Are you sure you want to change the base?
Conversation
@@ -121,9 +122,14 @@ void MultiDatabaseAuth(memgraph::query::QueryUserOrRole *user, std::string_view | |||
namespace memgraph::glue { | |||
|
|||
#ifdef MG_ENTERPRISE | |||
std::string SessionHL::GetDefaultDB() { | |||
std::optional<std::string> SessionHL::GetDefaultDB() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future change: do we want stronger default DB? name + uuid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense.
I will implement this now, since we missed the 2.17 release.
expected.append(", ".join(details)) | ||
execute_checker(checker_binary, expected) | ||
print("\033[1;36m~~ Finished permissions test ~~\033[0m\n") | ||
# # Run the test with all combinations of permissions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this bring removed or updated?
Description
Allow users to connect without a database defined.
If a user has a default db, the user will connect to that database.
If a user does not have a default db, we will connect without a database defined. Only db-less queries should be allowed.
If a user defines the database via the client, we will use the same logic as above, but each query will be executed against the user-defined db. Multi-tenant auth will be executed at first query execution.
Q: Should we allow multi-tenant queries (ex:
USE DATABASE x
) even without db? YESBugfix: Was not updating the explicit flag when user explicitly defines the same database as the current one. This would in turn allow db switching, which is prohibited if user connects via
mgclient.connect(database="db", ...)
[master < Task] PR
Documentation checklist