OpenSlides/openslides/topics/views.py
Oskar Hahn dd4754d045 Disable the future-lock when updating the restircted data cache
Before this commit, there where two different locks when updating the restricted
data cache. A future lock, what is faster but only works in the same thread. The
other lock is in redis, it is not so fast, but also works in many threads.

The future lock was buggy, because on a second call of update_restricted_data
the same future was reused. So on the second run, the future was already done.

I don't see any way to delete. The last client would have to delete it, but there
is no way to find out which client the last one is.
2019-03-04 21:37:00 +01:00

28 lines
808 B
Python

from openslides.utils.rest_api import ModelViewSet
from .access_permissions import TopicAccessPermissions
from .models import Topic
from ..utils.auth import has_perm
class TopicViewSet(ModelViewSet):
"""
API endpoint for topics.
There are the following views: metadata, list, retrieve, create,
partial_update, update and destroy.
"""
access_permissions = TopicAccessPermissions()
queryset = Topic.objects.all()
def check_view_permissions(self):
"""
Returns True if the user has required permissions.
"""
if self.action in ("list", "retrieve"):
result = self.get_access_permissions().check_permissions(self.request.user)
else:
result = has_perm(self.request.user, "agenda.can_manage")
return result