2016-02-11 22:58:32 +01:00
|
|
|
from ..utils.access_permissions import BaseAccessPermissions
|
|
|
|
|
|
|
|
|
|
|
|
class MotionAccessPermissions(BaseAccessPermissions):
|
|
|
|
"""
|
|
|
|
Access permissions container for Motion and MotionViewSet.
|
|
|
|
"""
|
|
|
|
def can_retrieve(self, user):
|
|
|
|
"""
|
|
|
|
Returns True if the user has read access model instances.
|
|
|
|
"""
|
|
|
|
return user.has_perm('motions.can_see')
|
|
|
|
|
2016-03-02 00:46:19 +01:00
|
|
|
def get_serializer_class(self, user=None):
|
2016-02-11 22:58:32 +01:00
|
|
|
"""
|
|
|
|
Returns serializer class.
|
|
|
|
"""
|
|
|
|
from .serializers import MotionSerializer
|
|
|
|
|
|
|
|
return MotionSerializer
|
|
|
|
|
|
|
|
|
|
|
|
class CategoryAccessPermissions(BaseAccessPermissions):
|
|
|
|
"""
|
|
|
|
Access permissions container for Category and CategoryViewSet.
|
|
|
|
"""
|
|
|
|
def can_retrieve(self, user):
|
|
|
|
"""
|
|
|
|
Returns True if the user has read access model instances.
|
|
|
|
"""
|
|
|
|
return user.has_perm('motions.can_see')
|
|
|
|
|
2016-03-02 00:46:19 +01:00
|
|
|
def get_serializer_class(self, user=None):
|
2016-02-11 22:58:32 +01:00
|
|
|
"""
|
|
|
|
Returns serializer class.
|
|
|
|
"""
|
|
|
|
from .serializers import CategorySerializer
|
|
|
|
|
|
|
|
return CategorySerializer
|
|
|
|
|
|
|
|
|
|
|
|
class WorkflowAccessPermissions(BaseAccessPermissions):
|
|
|
|
"""
|
|
|
|
Access permissions container for Workflow and WorkflowViewSet.
|
|
|
|
"""
|
|
|
|
def can_retrieve(self, user):
|
|
|
|
"""
|
|
|
|
Returns True if the user has read access model instances.
|
|
|
|
"""
|
|
|
|
return user.has_perm('motions.can_see')
|
|
|
|
|
2016-03-02 00:46:19 +01:00
|
|
|
def get_serializer_class(self, user=None):
|
2016-02-11 22:58:32 +01:00
|
|
|
"""
|
|
|
|
Returns serializer class.
|
|
|
|
"""
|
|
|
|
from .serializers import WorkflowSerializer
|
|
|
|
|
|
|
|
return WorkflowSerializer
|