Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for permission classes specified using rest_condition #148

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Support for permission classes specified using rest_condition #148

wants to merge 2 commits into from

Conversation

argoyal
Copy link

@argoyal argoyal commented Nov 26, 2016

Basically the idea of this change is that if the permission classes is specified not by adding the permissions classes in the tuple but by using a third party resource providing us with conditional usage of permissions, the get_permissions_class fails, because this conditional permission creates an object for the condition.

For eg. if we have a view specified as.

from rest_condition import OR

class ABCView(ModelViewSet):
    permission_classes = (OR(Permission1, Permission2),)
    """Some other stuff"""

The error in this case comes out to be Condition object has no attribute name, which makes sense.

Kindly look into the issue if this is mergeable.

Maybe there is a better approach to do this....

Thanks!
Arpit

Copy link

@dalexander-trc dalexander-trc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a problem for me, applying this easy fix gets me past the "Condition object has no attribute name" error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants