Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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 JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
50589b09
Commit
50589b09
authored
9 years ago
by
Kevin S. Hahn
Browse files
Options
Downloads
Patches
Plain Diff
limit non superuser search based on permissions
parent
0ac9655c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core.py
+4
-4
4 additions, 4 deletions
core.py
with
4 additions
and
4 deletions
core.py
+
4
−
4
View file @
50589b09
...
...
@@ -430,8 +430,6 @@ class Core(base.RequestHandler):
self
.
abort
(
400
,
str
(
e
))
# TODO: search needs to include operator details? do types of datasets have an 'operator'?
# TODO: sessions need to have more 'subject' information to be able to do age searching
# construct the queries based on the information available
# TODO: provide a schema that allows directly using the request data, rather than
# requiring construction of the queries....
session_query
=
{}
...
...
@@ -477,13 +475,15 @@ class Core(base.RequestHandler):
pass
# also query sessions
# permissions exist at the session level, which will limit the acquisition queries to sessions user has access to
if
not
self
.
superuser_request
:
session_query
[
'
permissions
'
]
=
{
'
$elemMatch
'
:
{
'
_id
'
:
self
.
uid
,
'
site
'
:
self
.
source_site
}}
acq_query
[
'
permissions
'
]
=
{
'
$elemMatch
'
:
{
'
_id
'
:
self
.
uid
,
'
site
'
:
self
.
source_site
}}
sessions
=
list
(
self
.
app
.
db
.
sessions
.
find
(
session_query
))
session_ids
=
[
s
[
'
_id
'
]
for
s
in
sessions
]
log
.
debug
(
session_ids
)
# first find the acquisitions that meet the acquisition level query params
aquery
=
{
'
session
'
:
{
'
$in
'
:
session_ids
}}
aquery
.
update
(
acq_query
)
log
.
debug
(
aquery
)
# build a more complex response, and clean out database specifics
groups
=
[]
...
...
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