misc: fix check of manager's roles ou (#48372)

This commit is contained in:
Benjamin Dauvergne 2020-12-01 22:47:07 +01:00
parent e7a6477635
commit c0c98c2da5
1 changed files with 5 additions and 3 deletions

View File

@ -236,9 +236,11 @@ class Command(BaseCommand):
with fake_atomic() as fake_state:
admin_role = role.get_admin_role()
ok = set(manager_roles) <= set([admin_role])
if ok:
if admin_role.ou != role.ou:
self.warning('- "%s" wrong ou, should be "%s" and is "%s"', admin_role, role.ou, admin_role.ou)
if ok and manager_roles:
if list(manager_roles)[0].ou != role.ou:
self.warning(
'- "%s" detected wrong ou, should be "%s" and is "%s"',
admin_role, role.ou, admin_role.ou)
to_change_ou.append((admin_role, role.ou))
continue
add_members = set()