Remove Sentry permission

parent 3cd7b430
......@@ -9,14 +9,6 @@ members.api package
Submodules
----------
members.api.permissions module
------------------------------
.. automodule:: members.api.permissions
:members:
:undoc-members:
:show-inheritance:
members.api.serializers module
------------------------------
......@@ -33,14 +25,6 @@ members.api.urls module
:undoc-members:
:show-inheritance:
members.api.views module
------------------------
.. automodule:: members.api.views
:members:
:undoc-members:
:show-inheritance:
members.api.viewsets module
---------------------------
......
from django.conf import settings
from rest_framework import permissions
class SentryIdentityPermission(permissions.BasePermission):
"""
Permission check for Sentry secret key and access permission
"""
def has_permission(self, request, view):
if 'secret' in request.GET:
return (request.GET['secret'] == settings.MEMBERS_SENTRY_API_SECRET
and request.user.has_perm('members.sentry_access'))
return False
......@@ -171,9 +171,3 @@ class ProfileEditSerializer(serializers.ModelSerializer):
return create_image_thumbnail_dict(
self.context['request'], file, placeholder=placeholder,
size_large='800x800')
class SentryIdentitySerializer(serializers.ModelSerializer):
class Meta:
model = Member
fields = ('pk', 'first_name', 'last_name', 'email', 'is_superuser')
from django.urls import path
from rest_framework import routers
from members.api import viewsets, views
from members.api import viewsets
router = routers.SimpleRouter()
router.register(r'members', viewsets.MemberViewset)
urlpatterns = router.urls + [
path('sentry-access/', views.SentryIdentityView.as_view()),
]
urlpatterns = router.urls
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from members.api.permissions import SentryIdentityPermission
from members.api.serializers import SentryIdentitySerializer
class SentryIdentityView(APIView):
permission_classes = (IsAuthenticated, SentryIdentityPermission)
def get(self, request, format=None):
serializer = SentryIdentitySerializer(request.user)
return Response(serializer.data)
# Generated by Django 2.2.1 on 2019-06-05 19:18
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('members', '0033_auto_20190428_1255'),
]
operations = [
migrations.AlterModelOptions(
name='member',
options={'ordering': ('first_name', 'last_name'), 'permissions': (('nextcloud_admin', 'Access NextCloud as admin'),)},
),
]
......@@ -96,7 +96,6 @@ class Member(User):
proxy = True
ordering = ('first_name', 'last_name')
permissions = (
('sentry_access', _("Access the Sentry backend")),
('nextcloud_admin', _("Access NextCloud as admin")),
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment