-
Notifications
You must be signed in to change notification settings - Fork 77
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
257 user model refactor the config handling #433
Conversation
src/db.py
Outdated
auth_enabled = self.db.get_mquery_config_key("auth_enabled") | ||
if not auth_enabled or auth_enabled == "false": | ||
return False | ||
return True |
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.
auth_enabled = self.db.get_mquery_config_key("auth_enabled") | |
if not auth_enabled or auth_enabled == "false": | |
return False | |
return True | |
return self.db.get_mquery_config_key("auth_enabled") == "true" |
Tiny chance in behaviour, but consistent with query_allow_slow (and works the same way for "true" and "false")
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.
brilliant :)
src/db.py
Outdated
] | ||
|
||
@property | ||
def openid_client_id(self) -> str: |
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.
def openid_client_id(self) -> str: | |
def openid_client_id(self) -> str | None: |
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.
(if this causes type errors somewhere else, callers should be fixed to handle the situation where this is null)
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.
Done
src/db.py
Outdated
return True | ||
|
||
@property | ||
def openid_url(self) -> str: |
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.
def openid_url(self) -> str: | |
def openid_url(self) -> str | None: |
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.
Done
src/schema.py
Outdated
@@ -101,7 +101,7 @@ class BackendStatusDatasetsSchema(BaseModel): | |||
|
|||
class ServerSchema(BaseModel): | |||
version: str | |||
auth_enabled: Optional[str] | |||
auth_enabled: Optional[bool] |
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.
I suspect this will cause issues on the frontend (but you can check). Unfortunately, you should probably cast to str when creating ServerSchema.
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.
LGTM
Your checklist for this pull request
What is the current behaviour?
db.get_mquery_config_key("default_role) when called returns different types
What is the new behaviour?
I created UserModelConfig with properties like auth_default_roles, openid_client_id, query_allow_slow etc. and now i call db.config.default_role
Test plan
Closing issues
fixes #257