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

docs: adr for data storage in course_roles djangoapp #33241

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

hsinkoff
Copy link
Member

Description

This PR is a PR to a feature branch with an ADR about the way in which data will be stored for course_roles.

Supporting information

Relates to openedx/platform-roadmap#246
https://discuss.openedx.org/t/translating-strings-from-db-fields/11143/2

Copy link
Member

@lucascalvino lucascalvino left a comment

Choose a reason for hiding this comment

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

LGTM

@hsinkoff hsinkoff merged commit 51c65e2 into ROLES-2-course_roles_setup Sep 13, 2023
@hsinkoff hsinkoff deleted the ROLES-19-i18n_options branch September 13, 2023 15:53
We will be using a combination of data storage in the database and data storage structures within the code.
We will store the roles, permissions, role permissions (rolepermission table), and role assignments (userrole table) in the database.
We will store the role names (for default roles), permission names, and permission descriptions in a data object in the code.
We will write code that pulls the role name from the database table for any role not found in the data object in the code. This applies to non-default roles that may differ from instance to instance.
Copy link
Contributor

Choose a reason for hiding this comment

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

To me, this sounds like there are two sources of truth, and I think there's a simpler approach.

Namely:

  • We will store the roles, permissions, role permissions (rolepermission table), role assignments (userrole table), role names (for default roles), permission names, and permission descriptions in the database.
  • "Default" roles and permissions used by all Open edX instances will be created in the database via migrations.
  • Before displaying role names, permission names, or permission descriptions to the user we will use pgettext to translate them into the user's locale if a translation is available.
  • Somewhere in the code we will maintain a list of strings, marked for translation, that contains the names and descriptions of the default roles and permissions. This code will not be directly used at runtime, but only exists to ensure that the names/descriptions are detected and made available for localization. (This could even be done in the data migration files themselves, which would be the most efficient.)

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.

3 participants