rest_condition
rest_condition copied to clipboard
Complex permissions flow for django-rest-framework (http://django-rest-framework.org).
DRF has a built-in way of providing custom error messages. However, these error messages are currently ignored by 'rest_condition' classes. Instead, the default error message is always used. In DRF,...
Updated tests for django 2.0.
In my viewset I have the following: `permission_classes = [ Or(And(IsReadOnlyRequest, IsAuthenticated), And(IsPutRequest, IsObjectUser)) ]` Where IsObjectUser has: `def has_object_permission(self, request, view, obj): return obj.user == request.user` The has_object_permission method...
Add a custom Boolean type in order to be able to provide custom descriptive message along the error status. In that case, the following would be possible. ``` python from...
Plz mention in docs that in order to achieve correct combining `has_permission` with `has_object_permission` We need to both override both `has_object_permission` and `has_permission` For example class OperatorPermission(permissions.BasePermission): """ Allowing access...
Because C.has_permission and C.has_object_permission both run `self.evaluate_permissions()` in a disconnected manner, this leads to the following logical error when OR-ing permissions: Given ``` A = hpA & hopA, and B...
I've defined a fairly standard set of permissions, and am using rest_condition to generate a set of conditional permissions. I'm also trying to use these w/ the `IsAuthenticated` permission class,...