From 23e86d6f7cd8bd1454d3e91019e9f0607e9f3d97 Mon Sep 17 00:00:00 2001 From: Art Lukyanchyk <artiom.lukyanchyk@hs-hannover.de> Date: Thu, 6 Jan 2022 13:34:03 +0100 Subject: [PATCH] Revert 92815998 because it breaks creation of predefined groups with django.contrib permissions This reverts commit 92815998b792e0fbf6c024a45369c3c8ba15a0ab. --- .../management/commands/ssoauth_setup_groups_and_perms.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ssoauth/management/commands/ssoauth_setup_groups_and_perms.py b/ssoauth/management/commands/ssoauth_setup_groups_and_perms.py index 7bc2828..4c74434 100644 --- a/ssoauth/management/commands/ssoauth_setup_groups_and_perms.py +++ b/ssoauth/management/commands/ssoauth_setup_groups_and_perms.py @@ -16,14 +16,13 @@ def get_or_create_permission(codename, create_with_name=None): :return: permission object Ensures the permissions exists. Creates it if needed. """ - user_content_type = get_user_content_type() try: - perm = Permission.objects.get(codename=codename, content_type=user_content_type) + perm = Permission.objects.get(codename=codename) except Permission.DoesNotExist: perm = Permission.objects.create( codename=codename, name=create_with_name or codename, - content_type=user_content_type + content_type=get_user_content_type() ) logger.info("Created permission: {0}".format(perm)) return perm -- GitLab