dfunckt / django-rules

Awesome Django authorization, without the database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rules don't seem to work on CBVs

Brachamul opened this issue · comments

I've posted a question a few days ago with all my code.

My user is redirected even if they have the proper permissions.

https://stackoverflow.com/questions/46672950/using-django-rules-with-cbvs-doesnt-seem-to-work

It's probable that something is wrong with my code, but maybe it's a bug instead?

This is not a django-rules bug, this is an error in the setup of the project mentioned in the link.
See my response in the stackoverflow question.

What happens if you change your test to self.assertEqual(self.user.has_perm('restaurants.change_restaurant', self.restaurant), True)?

@dfunckt: The issue was not related to django-rules.

See
code diff and test run

You can close this issue :)

@Brachamul: please confirm, that my pull request solves this issue and that the issue was not a django-rules bug.

The issue is indeed fixed ! Thank you a ton.

AUTHENTICATION_BACKENDS were set for both django-rules and django-allauth, and the second ones were overriding the first.

Is there a way for rules to display a warning when its authentication backend isn't in settings ?