Features: 1) Add "seo" action with "view" permission mapping in EvibesPermission; 2) Extend action serializer classes with additional "seo" allowance in multiple viewsets.
Fixes: 1) None. Extra: 1) Minor adjustments in viewsets for consistency in handling "seo" action.
This commit is contained in:
parent
5556cd008d
commit
d767e17f29
2 changed files with 4 additions and 0 deletions
|
|
@ -17,6 +17,7 @@ class IsOwnerOrReadOnly(permissions.BasePermission):
|
||||||
class EvibesPermission(permissions.BasePermission):
|
class EvibesPermission(permissions.BasePermission):
|
||||||
ACTION_PERM_MAP = {
|
ACTION_PERM_MAP = {
|
||||||
"retrieve": "view",
|
"retrieve": "view",
|
||||||
|
"seo": "view",
|
||||||
"list": "view",
|
"list": "view",
|
||||||
"create": "add",
|
"create": "add",
|
||||||
"update": "change",
|
"update": "change",
|
||||||
|
|
|
||||||
|
|
@ -283,6 +283,7 @@ class CategoryViewSet(EvibesViewSet):
|
||||||
action_serializer_classes = {
|
action_serializer_classes = {
|
||||||
"list": CategorySimpleSerializer,
|
"list": CategorySimpleSerializer,
|
||||||
}
|
}
|
||||||
|
additional = {"seo": "ALLOW"}
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
qs = super().get_queryset()
|
qs = super().get_queryset()
|
||||||
|
|
@ -378,6 +379,7 @@ class BrandViewSet(EvibesViewSet):
|
||||||
action_serializer_classes = {
|
action_serializer_classes = {
|
||||||
"list": BrandSimpleSerializer,
|
"list": BrandSimpleSerializer,
|
||||||
}
|
}
|
||||||
|
additional = {"seo": "ALLOW"}
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
queryset = Brand.objects.all()
|
queryset = Brand.objects.all()
|
||||||
|
|
@ -477,6 +479,7 @@ class ProductViewSet(EvibesViewSet):
|
||||||
}
|
}
|
||||||
lookup_field = "lookup_value"
|
lookup_field = "lookup_value"
|
||||||
lookup_url_kwarg = "lookup_value"
|
lookup_url_kwarg = "lookup_value"
|
||||||
|
additional = {"seo": "ALLOW"}
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
qs = super().get_queryset()
|
qs = super().get_queryset()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue