Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.web
Commits
46a86b6c
Commit
46a86b6c
authored
4 years ago
by
Samuel GAIST
Browse files
Options
Downloads
Patches
Plain Diff
[databases][api] Move from custom permission mixins to use permissions
parent
befb3537
No related branches found
No related tags found
1 merge request
!327
Refactor update creation api
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/web/databases/api.py
+6
-5
6 additions, 5 deletions
beat/web/databases/api.py
with
6 additions
and
5 deletions
beat/web/databases/api.py
+
6
−
5
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
"
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment