fix "all" issue on pushing

This commit is contained in:
Zsombor Barna 2022-06-23 13:49:12 +02:00
parent 192dd66aaf
commit 61369085f3
1 changed files with 7 additions and 9 deletions

16
admin
View File

@ -39,15 +39,13 @@ def construct_predicate(id_list, group_list):
def construct_predicate_for_pushing(id_list, group_list, own_keys):
def predicate(id, group):
with open(workdir/Path(id)) as keylist:
# maybe make it into a set?
for key in keylist:
if key in own_keys:
return ((id in id_list) or
set(groups).intersection(group_list))
else:
# no 'break' means no pub keys in file
print(f"None of the local public keys are in the keyfile for {id}")
return False
if any(key in own_keys for key in keylist):
return ("all" in (group_list+id_list) or
(id in id_list) or
set(groups).intersection(group_list)):
print(f"None of the local public keys are in the keyfile for {id}")
return False
return predicate
def execute(operation, predicate):