2016-09-18 22:14:24 +02:00
|
|
|
from ..utils.access_permissions import BaseAccessPermissions
|
2016-12-17 09:30:20 +01:00
|
|
|
from ..utils.auth import has_perm
|
2016-09-18 22:14:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
class TopicAccessPermissions(BaseAccessPermissions):
|
|
|
|
"""
|
|
|
|
Access permissions container for Topic and TopicViewSet.
|
|
|
|
"""
|
|
|
|
def check_permissions(self, user):
|
|
|
|
"""
|
|
|
|
Returns True if the user has read access model instances.
|
|
|
|
"""
|
2016-12-17 09:30:20 +01:00
|
|
|
return has_perm(user, 'agenda.can_see')
|
2016-09-18 22:14:24 +02:00
|
|
|
|
|
|
|
def get_serializer_class(self, user=None):
|
|
|
|
"""
|
|
|
|
Returns serializer class.
|
|
|
|
"""
|
|
|
|
from .serializers import TopicSerializer
|
|
|
|
|
|
|
|
return TopicSerializer
|