728576d514
* Add caching support to users/group * Add a function has_perm that works with the cache. * Removed our session backend so other session backends (without the database) can be used
22 lines
591 B
Python
22 lines
591 B
Python
from ..utils.access_permissions import BaseAccessPermissions
|
|
from ..utils.auth import has_perm
|
|
|
|
|
|
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.
|
|
"""
|
|
return has_perm(user, 'agenda.can_see')
|
|
|
|
def get_serializer_class(self, user=None):
|
|
"""
|
|
Returns serializer class.
|
|
"""
|
|
from .serializers import TopicSerializer
|
|
|
|
return TopicSerializer
|