Wokay, getting tired of breaking the entire permission/group ecosystem because of bugs when developing.

This commit is contained in:
Alexandre Aubin 2019-10-09 22:48:47 +02:00
parent 2617fd2487
commit c315df9269
2 changed files with 9 additions and 1 deletions

View file

@ -433,6 +433,9 @@ def app_map(app=None, raw=False, user=None):
continue
# Users must at least have access to the main permission to have access to extra permissions
if user:
if not app_id + ".main" in permissions:
logger.warning("Uhoh, no main permission was found for app %s ... sounds like an app was only partially removed due to another bug :/" % app_id)
continue
main_perm = permissions[app_id + ".main"]
if user not in main_perm["corresponding_users"] and "visitors" not in main_perm["allowed"]:
continue

View file

@ -268,7 +268,12 @@ def user_delete(operation_logger, username, purge=False):
# remove the member from the group
if username != group and username in infos["members"]:
user_group_update(group, remove=username, sync_perm=False)
user_group_delete(username, force=True, sync_perm=True)
# Delete primary group if it exists (why wouldnt it exists ? because some
# epic bug happened somewhere else and only a partial removal was
# performed...)
if username in user_group_list()['groups'].keys():
user_group_delete(username, force=True, sync_perm=True)
ldap = _get_ldap_interface()
try: