Projet

Général

Profil

0003-agent-authentic2-do-not-activate-new-and-old-role-im.patch

Benjamin Dauvergne, 15 septembre 2015 09:54

Télécharger (2,4 ko)

Voir les différences:

Subject: [PATCH 3/3] agent/authentic2: do not activate new and old role import
 at the same time (#8217)

 hobo/agent/authentic2/apps.py                                 | 11 ++++++-----
 hobo/agent/authentic2/management/commands/import-wcs-roles.py |  3 +++
 2 files changed, 9 insertions(+), 5 deletions(-)
hobo/agent/authentic2/apps.py
71 71
    verbose_name = 'Authentic2 Agent'
72 72

  
73 73
    def ready(self):
74
        Role = get_role_model()
75
        post_save.connect(notify_roles, Role)
76
        post_delete.connect(notify_roles, Role)
77
        post_save.connect(notify_roles, Role.members.through)
78
        post_delete.connect(notify_roles, Role.members.through)
74
        if getattr(settings, 'HOBO_ROLE_EXPORT', False):
75
            Role = get_role_model()
76
            post_save.connect(notify_roles, Role)
77
            post_delete.connect(notify_roles, Role)
78
            post_save.connect(notify_roles, Role.members.through)
79
            post_delete.connect(notify_roles, Role.members.through)
79 80
        settings.A2_MANAGER_ROLE_FORM_CLASS = 'hobo.agent.authentic2.role_forms.RoleForm'
hobo/agent/authentic2/management/commands/import-wcs-roles.py
11 11
from django.utils.text import slugify
12 12
from django.core.management.base import BaseCommand
13 13
from django.utils.translation import ugettext as _
14
from django.conf import settings
14 15

  
15 16
from authentic2.saml.models import LibertyProvider
16 17
from authentic2.a2_rbac.models import Role, RoleAttribute
......
131 132
    requires_system_checks = False
132 133

  
133 134
    def handle(self, *args, **options):
135
        if getattr(settings, 'HOBO_ROLE_EXPORT', False):
136
            return
134 137
        # traverse list of tenants
135 138
        for tenant in TenantMiddleware.get_tenants():
136 139
            with tenant_context(tenant):
137
-