Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.web
Commits
46a86b6c
Commit
46a86b6c
authored
Apr 24, 2020
by
Samuel GAIST
Browse files
[databases][api] Move from custom permission mixins to use permissions
parent
befb3537
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/web/databases/api.py
View file @
46a86b6c
...
...
@@ -30,7 +30,7 @@ import json
import
logging
from
rest_framework.response
import
Response
from
rest_framework
import
permissions
from
rest_framework
import
permissions
as
drf_permissions
from
rest_framework
import
exceptions
as
drf_exceptions
from
rest_framework
import
views
...
...
@@ -40,7 +40,7 @@ from .models import DatabaseSetTemplate
from
.serializers
import
DatabaseSerializer
,
DatabaseCreationSerializer
from
..common
import
is_true
from
..common
.mixins
import
IsAdminOrReadOnlyMixin
from
..common
import
permissions
as
beat_permissions
from
..common.api
import
ListCreateBaseView
from
..common.utils
import
ensure_html
...
...
@@ -117,7 +117,7 @@ def clean_paths(declaration):
# ----------------------------------------------------------
class
ListCreateDatabasesView
(
IsAdminOrReadOnlyMixin
,
ListCreateBaseView
):
class
ListCreateDatabasesView
(
ListCreateBaseView
):
"""
Read/Write end point that list the database available
to a user and allows the creation of new databases only to
...
...
@@ -125,6 +125,7 @@ class ListCreateDatabasesView(IsAdminOrReadOnlyMixin, ListCreateBaseView):
"""
model
=
Database
permission_classes
=
[
beat_permissions
.
IsAdminOrReadOnly
]
serializer_class
=
DatabaseSerializer
writing_serializer_class
=
DatabaseCreationSerializer
namespace
=
"api_databases"
...
...
@@ -159,7 +160,7 @@ class ListTemplatesView(views.APIView):
List all templates available
"""
permission_classes
=
[
permissions
.
AllowAny
]
permission_classes
=
[
drf_
permissions
.
AllowAny
]
def
get
(
self
,
request
):
result
=
{}
...
...
@@ -209,7 +210,7 @@ class RetrieveDatabaseView(views.APIView):
"""
model
=
Database
permission_classes
=
[
permissions
.
AllowAny
]
permission_classes
=
[
drf_
permissions
.
AllowAny
]
def
get_object
(
self
):
version
=
self
.
kwargs
[
"version"
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment