Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Michael Coughlin
GraceDB Server
Commits
a5855a13
Commit
a5855a13
authored
6 years ago
by
Tanner Prestegard
Committed by
GraceDB
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Adding permissions to all superevents API views
parent
8ed9759c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gracedb/superevents/api/views.py
+22
-1
22 additions, 1 deletion
gracedb/superevents/api/views.py
with
22 additions
and
1 deletion
gracedb/superevents/api/views.py
+
22
−
1
View file @
a5855a13
...
...
@@ -32,6 +32,11 @@ from .filters import SupereventSearchFilter, SupereventOrderingFilter, \
from
.mixins
import
SafeCreateMixin
,
SafeDestroyMixin
from
.paginators
import
BasePaginationFactory
,
CustomLabelPagination
,
\
CustomLogTagPagination
,
CustomSupereventPagination
from
.permissions
import
SupereventModelPermissions
,
\
SupereventObjectPermissions
,
SupereventLabellingModelPermissions
,
\
EventParentSupereventPermissions
,
SupereventLogModelPermissions
,
\
SupereventLogTagModelPermissions
,
SupereventLogTagObjectPermissions
,
\
SupereventVOEventModelPermissions
,
ParentSupereventAnnotatePermissions
from
.serializers
import
SupereventSerializer
,
SupereventUpdateSerializer
,
\
SupereventEventSerializer
,
SupereventLabelSerializer
,
\
SupereventLogSerializer
,
SupereventLogTagSerializer
,
\
...
...
@@ -51,6 +56,8 @@ class SupereventViewSet(SafeCreateMixin, viewsets.ModelViewSet):
queryset
=
Superevent
.
objects
.
all
()
serializer_class
=
SupereventSerializer
pagination_class
=
CustomSupereventPagination
permission_classes
=
(
permissions
.
IsAuthenticatedOrReadOnly
,
SupereventModelPermissions
,
SupereventObjectPermissions
,)
lookup_url_kwarg
=
SUPEREVENT_LOOKUP_URL_KWARG
lookup_value_regex
=
SUPEREVENT_LOOKUP_REGEX
filter_backends
=
(
DjangoObjectAndGlobalPermissionsFilter
,
...
...
@@ -105,6 +112,8 @@ class SupereventEventViewSet(mixins.ListModelMixin,
"""
View for events attached to a superevent
"""
serializer_class
=
SupereventEventSerializer
pagination_class
=
BasePaginationFactory
(
results_name
=
'
events
'
)
permission_classes
=
(
permissions
.
IsAuthenticatedOrReadOnly
,
EventParentSupereventPermissions
,)
lookup_url_kwarg
=
'
graceid
'
destroy_error_classes
=
(
Superevent
.
PreferredEventRemovalError
,)
destroy_error_response_status
=
status
.
HTTP_400_BAD_REQUEST
...
...
@@ -138,6 +147,8 @@ class SupereventLabelViewSet(viewsets.ModelViewSet,
"""
Superevent labels
"""
serializer_class
=
SupereventLabelSerializer
pagination_class
=
CustomLabelPagination
permission_classes
=
(
permissions
.
IsAuthenticatedOrReadOnly
,
SupereventLabellingModelPermissions
,)
lookup_url_kwarg
=
'
label_name
'
lookup_field
=
'
label__name
'
...
...
@@ -162,6 +173,8 @@ class SupereventLogViewSet(mixins.ListModelMixin,
serializer_class
=
SupereventLogSerializer
pagination_class
=
BasePaginationFactory
(
results_name
=
'
log
'
)
filter_backends
=
(
DjangoObjectAndGlobalPermissionsFilter
,)
permission_classes
=
(
permissions
.
IsAuthenticatedOrReadOnly
,
SupereventLogModelPermissions
,
ParentSupereventAnnotatePermissions
,)
lookup_url_kwarg
=
'
N
'
lookup_field
=
'
N
'
...
...
@@ -169,7 +182,9 @@ class SupereventLogViewSet(mixins.ListModelMixin,
# Get full set of logs for superevent
superevent
=
self
.
get_parent_object
()
queryset
=
superevent
.
log_set
.
all
().
order_by
(
'
N
'
)
# filter for those tagged with external access tagname if is_external(request.user)
# NOTE: filtering of logs by view permissions is handled in
# filter_queryset by the filter backends.
return
queryset
...
...
@@ -183,6 +198,8 @@ class SupereventLogTagViewSet(mixins.ListModelMixin,
"""
serializer_class
=
SupereventLogTagSerializer
pagination_class
=
CustomLogTagPagination
permission_classes
=
(
permissions
.
IsAuthenticatedOrReadOnly
,
SupereventLogTagModelPermissions
,
SupereventLogTagObjectPermissions
,)
lookup_url_kwarg
=
'
tag_name
'
lookup_field
=
'
name
'
...
...
@@ -248,6 +265,8 @@ class SupereventVOEventViewSet(mixins.ListModelMixin,
"""
serializer_class
=
SupereventVOEventSerializer
pagination_class
=
BasePaginationFactory
(
results_name
=
'
voevents
'
)
permission_classes
=
(
permissions
.
IsAuthenticatedOrReadOnly
,
SupereventVOEventModelPermissions
,)
create_error_classes
=
(
VOEventBuilderException
)
lookup_url_kwarg
=
'
N
'
lookup_field
=
'
N
'
...
...
@@ -268,6 +287,8 @@ class SupereventEMObservationViewSet(mixins.ListModelMixin,
"""
serializer_class
=
SupereventEMObservationSerializer
pagination_class
=
BasePaginationFactory
(
results_name
=
'
observations
'
)
permission_classes
=
(
permissions
.
IsAuthenticatedOrReadOnly
,
ParentSupereventAnnotatePermissions
,)
lookup_url_kwarg
=
'
N
'
lookup_field
=
'
N
'
...
...
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