AACEngineering / django-permissions-auditor

Tool to audit access control on your django app.
https://django-permissions-auditor.readthedocs.io/en/latest/
MIT License
20 stars 4 forks source link

Fix AuditorGroupAdmin for use with custom user model. #11

Closed LerikG closed 3 years ago

LerikG commented 3 years ago

As specified in https://docs.djangoproject.com/en/dev/ref/contrib/admin/#admin-reverse-urls, Django builds admin urls from the app_label and model_name fields. The AuditorGroupAdmin view uses hardcoded string "auth_user_change" in the reverse() call which breaks for Django instances using a custom user model.

Fix reverse() to use a string based on the app_label and model_name fields of the User object already retrieved with get_user_model().

codecov[bot] commented 3 years ago

Codecov Report

Merging #11 (9db817e) into master (517b1e2) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #11   +/-   ##
=======================================
  Coverage   92.21%   92.21%           
=======================================
  Files           7        7           
  Lines         347      347           
  Branches       81       81           
=======================================
  Hits          320      320           
  Misses          8        8           
  Partials       19       19           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 517b1e2...f7a6b0d. Read the comment docs.

kluchrj commented 3 years ago

Thanks. I rebased and fixed the lint error.