ManagedGroup.anvil_audit_membership fails when the app service account is not a direct admin of a group
Closed this issue · 0 comments
amstilp commented
This bug occurs when:
- The service account is not a direct admin of a group, but is an admin via another group that is an admin of the first group.
Result: The audit succeeds.
Expected result: The audit fails with a 500 server error and the following traceback:
Traceback (most recent call last):
File "venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
File "venv/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "venv/lib/python3.8/site-packages/django/contrib/auth/mixins.py", line 104, in dispatch
return super().dispatch(request, *args, **kwargs)
File "venv/lib/python3.8/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "venv/lib/python3.8/site-packages/anvil_consortium_manager/views.py", line 97, in get
self.run_audit()
File "venv/lib/python3.8/site-packages/anvil_consortium_manager/views.py", line 1225, in run_audit
self.audit_results = models.ManagedGroup.anvil_audit()
File "venv/lib/python3.8/site-packages/anvil_consortium_manager/models.py", line 733, in anvil_audit
if not group.anvil_audit_membership().ok():
File "venv/lib/python3.8/site-packages/anvil_consortium_manager/models.py", line 618, in anvil_audit_membership
admins_in_anvil.remove(
ValueError: list.remove(x): x not in list