vintasoftware / django-role-permissions

A django app for role based permissions.
http://django-role-permissions.readthedocs.org/
MIT License
730 stars 115 forks source link

Fail grcefully when unregistering a custom user module that is not re… #131

Closed soloincc closed 1 year ago

soloincc commented 3 years ago

…gistered

soloincc commented 3 years ago

When a user has no permission or no role, allow redirect to an alternative url instead of the login url.

A user might be signed in properly but accessing a forbidden resource, instead of being redirected to the login url, the user can be redirected to an alternative url where they are permitted

fjsj commented 3 years ago

Thanks @soloincc , could you please add documentation and tests to this new behavior? Please document too that redirect_url has precedence over redirect_to_login and ROLEPERMISSIONS_REDIRECT_TO_LOGIN

soloincc commented 3 years ago

@fjsj, I have added the documentation and tests

fjsj commented 3 years ago

@soloincc

Thanks! I think we're missing one additional test case just for this behavior. On the test, set redirect_to_login and check if redirect_url overrides it. Could you please write this new test case?

fjsj commented 3 years ago

Also, could you please allow me to edit the PR? Check: https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork

soloincc commented 3 years ago

It seems I can't give you permissions to edit the PR since the repo is owned by an organisation. https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/about-forks

soloincc commented 3 years ago

I have added the tests.