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

Add missing authorizations app for commonground-api-common #70

Closed
wants to merge 1 commit into from

Conversation

SonnyBA
Copy link
Contributor

@SonnyBA SonnyBA commented Sep 17, 2024

Fixes makemigrations creating a new migration for several authorization models.

Changes
The migrations that are currently generated when running makemigrations in open-klant generates a migration with models for the authorizations app because the migrations in the existing app are not recognized (as the app is not in the INSTALLED_APPS)

See https://github.com/maykinmedia/commonground-api-common/blob/1.12.1/docs/quickstart.rst?plain=1#L43.
Also see the check_migrations CI job that encountered this issue.

@@ -211,6 +211,7 @@
"csp",
"corsheaders",
"vng_api_common",
"vng_api_common.authorizations",
Copy link
Contributor

Choose a reason for hiding this comment

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

@SonnyBA come to think of it, I'm actually not sure if all components use this (e.g. Objects/Objecttypes), so wouldn't it be better to add this only to the components that need it? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Open-zaak (commonground-api-common used the middleware class from this project), Open-Klant and Open-Notificaties use the authorizations app from commonground-api-common.

I think the migrations authorizations migrations currently are recognized (even if the app is not installed) because the middleware.py imports them. It should be easily fixed though whenever we move the authorization related middleware to the authorizations app. This probably requires a new release though of OAF (because all projects pull in commonground-api-common through OAF) and commonground-api-common.

The current suggested fix is probably a bit less work but is also the uglier solution. @Coperh @stevenbal which option would you prefer?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be best to indeed move the middleware to the authorizations app. I think this also relates to #67, we should make these dependencies should be optional at some point probably

SonnyBA pushed a commit to maykinmedia/commonground-api-common that referenced this pull request Oct 17, 2024
This fixes applications not including the `vng_api_common.authorizations` app to create duplicate migrations. See maykinmedia/open-api-framework#70 (comment)
@stevenbal stevenbal marked this pull request as draft October 25, 2024 08:58
@stevenbal
Copy link
Contributor

closing this, because we instead opted to move the middleware in commonground-api-common: maykinmedia/commonground-api-common#36

@stevenbal stevenbal closed this Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants