digitalfabrik / integreat-cms

Simplified content management back end for the Integreat App - a multilingual information platform for newcomers
https://digitalfabrik.github.io/integreat-cms/
Apache License 2.0
56 stars 34 forks source link

Manage permission in fixture again instead of migrations #1857

Open timobrembeck opened 1 year ago

timobrembeck commented 1 year ago

Motivation

In the early stages of this project, we stored the permission in a fixture which we could just update by running integreat-cms-cli loadddata roles.

The main problem with this approach was that we referenced permissions by ids, and on the dev systems the ids of the permissions changed each time the database was reset after a model change. Thus, I suggested the current mechanism of managing roles via migrations (see #748).

However, I wasn't aware at the time that the readable (and constant) permission names could also be used as keys in the fixture instead of the numeric ids. Considering the current overhead of having to change the constants and then generate a migration which applies the changed constants, I think the previous approach wasn't too bad if we change the way we reference the permissions.

Proposed Solution

Alternatives

Just keep the current setup

timobrembeck commented 1 year ago

The file https://github.com/digitalfabrik/integreat-cms/blob/d3bd93af510d28d576d5a5f6629445b44fc17c48/integreat_cms/cms/fixtures/test_roles.json introduced in #2126 could be a good place to start for this.