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
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
IGWN Computing and Software
GraceDB
GraceDB Server
Commits
7fbfdb29
Commit
7fbfdb29
authored
8 years ago
by
Tanner Prestegard
Committed by
Alexander Pace
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
allowing access to singleInspiral times for external users
parent
ff91ec82
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gracedb/permission_utils.py
+10
-0
10 additions, 0 deletions
gracedb/permission_utils.py
gracedb/view_utils.py
+17
-9
17 additions, 9 deletions
gracedb/view_utils.py
with
27 additions
and
9 deletions
gracedb/permission_utils.py
+
10
−
0
View file @
7fbfdb29
...
...
@@ -124,6 +124,16 @@ def is_external(user):
else
:
return
True
#-------------------------------------------------------------------------------
# A utility for determining whether a user is accessing the API through the
# basic auth entry point.
#-------------------------------------------------------------------------------
def
is_basicapi_request
(
request
):
if
request
.
path
.
startswith
(
"
/apibasic/
"
):
return
True
else
:
return
False
#-------------------------------------------------------------------------------
# A utility for determining whether an external user should have access to a
# particular file, given the event and filename. This is done by finding the
...
...
This diff is collapsed.
Click to expand it.
gracedb/view_utils.py
+
17
−
9
View file @
7fbfdb29
...
...
@@ -26,6 +26,9 @@ MAX_FLEXI_ROWS = 250
GRACEDB_DATA_DIR
=
settings
.
GRACEDB_DATA_DIR
import
logging
log
=
logging
.
getLogger
(
__name__
)
import
json
import
pytz
...
...
@@ -153,7 +156,7 @@ def eventToDict(event, columns=None, request=None):
for labelling in event.labelling_set.all()])
# XXX Try to produce a dictionary of analysis specific attributes. Duck typing.
# XXX These extra attributes should only be seen by internal users.
if request and request.user and not is_external(request.user):
if request and request.user and not is_external(request.user):
rv[
'
extra_attributes
'
] = {}
try:
# GrbEvent
...
...
@@ -302,14 +305,19 @@ def eventToDict(event, columns=None, request=None):
si_set = event.singleinspiral_set.all()
if si_set.count():
rv[
'
extra_attributes
'
][
'
SingleInspiral
'
] = [ singleInspiralToDict(si) for si in si_set ]
elif request and request.user and is_external(request.user):
# Expose SingleInspiral times only for external users.
ext_keys = [
'
ifo
'
,
'
end_time
'
,
'
end_time_ns
'
]
si_set = event.singleinspiral_set.all()
if si_set.count():
SingleInspiral_list = [ singleInspiralToDict(si) for si in si_set ]
for i, si in enumerate(SingleInspiral_list):
rv[
'
extra_attributes
'
][
'
SingleInspiral
'
] = { k: si[k] for k in ext_keys }
elif (request and request.user) and (is_external(request.user)):
try:
rv[
'
extra_attributes
'
] = {}
# Only expose SingleInspiral times and ifos for external users.
ext_keys = [
'
ifo
'
,
'
end_time
'
,
'
end_time_ns
'
]
si_set = event.singleinspiral_set.all()
if si_set.count():
SingleInspiral_list = [ singleInspiralToDict(si) for si in si_set ]
rv[
'
extra_attributes
'
][
'
SingleInspiral
'
] = []
for i, si in enumerate(SingleInspiral_list):
rv[
'
extra_attributes
'
][
'
SingleInspiral
'
].append({ k: si[k] for k in ext_keys })
except:
pass
rv[
'
links
'
] = {
"
neighbors
"
: reverse(
"
neighbors
"
, args=[graceid], request=request),
...
...
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