mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 17:34:21 +01:00
simpler way to fill group hash in modify if key don't exist
This commit is contained in:
parent
0a4164c8b5
commit
53e4159ec9
@ -746,14 +746,10 @@ class LdapCherry(object):
|
|||||||
groups_add = self.roles.get_groups(roles_member)
|
groups_add = self.roles.get_groups(roles_member)
|
||||||
|
|
||||||
for b in groups_add:
|
for b in groups_add:
|
||||||
if b not in groups_add:
|
for g in [groups_add, groups_keep,
|
||||||
groups_add[b] = []
|
groups_current, lonely_groups]:
|
||||||
if b not in groups_keep:
|
if b not in g:
|
||||||
groups_keep[b] = []
|
g[b] = []
|
||||||
if b not in groups_current:
|
|
||||||
groups_current[b] = []
|
|
||||||
if b not in lonely_groups:
|
|
||||||
lonely_groups[b] = []
|
|
||||||
tmp = \
|
tmp = \
|
||||||
Set(groups_add[b]) - \
|
Set(groups_add[b]) - \
|
||||||
Set(groups_keep[b]) - \
|
Set(groups_keep[b]) - \
|
||||||
@ -766,18 +762,10 @@ class LdapCherry(object):
|
|||||||
)
|
)
|
||||||
self.backends[b].add_to_groups(username, tmp)
|
self.backends[b].add_to_groups(username, tmp)
|
||||||
for b in groups_rm:
|
for b in groups_rm:
|
||||||
if b not in groups_remove:
|
for g in [groups_remove, groups_rm, groups_add,
|
||||||
groups_remove[b] = []
|
groups_keep, groups_current, lonely_groups]:
|
||||||
if b not in groups_rm:
|
if b not in g:
|
||||||
groups_rm[b] = []
|
g[b] = []
|
||||||
if b not in groups_add:
|
|
||||||
groups_add[b] = []
|
|
||||||
if b not in groups_keep:
|
|
||||||
groups_keep[b] = []
|
|
||||||
if b not in groups_current:
|
|
||||||
groups_current[b] = []
|
|
||||||
if b not in lonely_groups:
|
|
||||||
lonely_groups[b] = []
|
|
||||||
tmp = \
|
tmp = \
|
||||||
(
|
(
|
||||||
(Set(groups_rm[b]) | Set(groups_remove[b])) -
|
(Set(groups_rm[b]) | Set(groups_remove[b])) -
|
||||||
|
Loading…
Reference in New Issue
Block a user