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

User model: Refactor the config handling #257

Open
Tracked by #304
msm-code opened this issue Dec 29, 2021 · 1 comment
Open
Tracked by #304

User model: Refactor the config handling #257

msm-code opened this issue Dec 29, 2021 · 1 comment
Assignees
Labels
next-sprint zone:backend Backend oriented tasks
Milestone

Comments

@msm-code
Copy link
Contributor

Part of #23

Right now we handle config very roughly. For example let's take:

auth_default_roles = db.get_mquery_config_key("auth_default_roles")
if auth_default_roles is None:
    default_roles = []
else:
    default_roles = [
        role.strip() for role in auth_default_roles.split(",")
    ]
  1. Default value is not declared anywhere, just used ad-hoc
  2. The code parses the config key at the point of usage. This obscures the intention and may lead to duplication
  3. Last but not least, the value is not validated when changed by the user. And typos here may lock users out and even make the system unusable.

I think about something like:

default_roles = db.config.auth_default_roles 

Where the auth_default_roles is a property that does the magic (parsing and validation)

@msm-cert
Copy link
Member

in other words:

Change all instances of db.get_mquery_config(...) to something like db.get_config that returns a well-typed Python object.

@msm-cert msm-cert added the zone:backend Backend oriented tasks label Sep 16, 2024
@msm-cert msm-cert added high priority Priority: high next-sprint and removed high priority Priority: high labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next-sprint zone:backend Backend oriented tasks
Projects
None yet
Development

No branches or pull requests

3 participants