CentreForDigitalHumanities / CentreForDigitalHumanities/langpro-annotator

Set permissions after migrating

Open
#102 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
5d 11h
Merged PRs (30d)
2

Description

When setting up a new server and running migrations for the first time, you currently get warning about non-existent permissions. This is because `0004_create_user_groups.py` (in the `user` app) tries to add permissions to user groups while the permissions themselves do not exist. Apparently, Django only creates these after running migrations (in the `post_migrate` signal, using `create_permissions`, cf. `django.contrib.auth.apps.AuthConfig`).

You can get around this by undoing and redoing the last migration

```sh
python manage.py migrate user 0003
python manage.py migrate user
```
Needless to say this is not a very nice setup. To solve this we could write a separate, idempotent script that is run after all migrations have been run and that sets all group permissions according to the overview in `backend/user/permissions.py`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.