mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 11:27:09 +00:00
[FEAT] Limit Map and Network views to admins
This commit is contained in:
@@ -7,6 +7,7 @@ from django.utils import timezone
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from people import forms, models, permissions
|
||||
from breccia_mapper.views import UserIsStaffMixin
|
||||
|
||||
|
||||
def get_map_data(obj: typing.Union[models.Person, models.Organisation]) -> typing.Dict[str, typing.Any]:
|
||||
@@ -33,7 +34,7 @@ def get_map_data(obj: typing.Union[models.Person, models.Organisation]) -> typin
|
||||
}
|
||||
|
||||
|
||||
class MapView(LoginRequiredMixin, TemplateView):
|
||||
class MapView(UserIsStaffMixin, LoginRequiredMixin, TemplateView):
|
||||
"""View displaying a map of :class:`Person` and :class:`Organisation` locations."""
|
||||
template_name = 'people/map.html'
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ from django.utils import timezone
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from people import forms, models, serializers
|
||||
from breccia_mapper.views import UserIsStaffMixin
|
||||
|
||||
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
|
||||
|
||||
@@ -57,7 +58,7 @@ filter_people = filter_by_form_answers(
|
||||
)
|
||||
|
||||
|
||||
class NetworkView(LoginRequiredMixin, TemplateView):
|
||||
class NetworkView(UserIsStaffMixin, LoginRequiredMixin, TemplateView):
|
||||
"""View to display relationship network."""
|
||||
template_name = 'people/network.html'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user