Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ippidb-web
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
iPPIDB
ippidb-web
Commits
e29e9a82
Commit
e29e9a82
authored
5 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
first approach at filtering viewed compounds based on permissions
WIP on #68
parent
2b1c8e9c
No related branches found
No related tags found
No related merge requests found
Pipeline
#20614
passed
5 years ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ippisite/ippidb/views/compound_query.py
+10
-0
10 additions, 0 deletions
ippisite/ippidb/views/compound_query.py
with
10 additions
and
0 deletions
ippisite/ippidb/views/compound_query.py
+
10
−
0
View file @
e29e9a82
...
@@ -564,6 +564,16 @@ class CompoundListView(ListView):
...
@@ -564,6 +564,16 @@ class CompoundListView(ListView):
self
.
filter_context
=
{}
self
.
filter_context
=
{}
# get queryset
# get queryset
qs
=
super
().
get_queryset
()
qs
=
super
().
get_queryset
()
# compounds can be accessed only if they are validated or
# if the current user is an admin OR their contributor
current_user
=
self
.
request
.
user
if
current_user
.
is_anonymous
:
qs
=
qs
.
exclude
(
compoundaction__ppi__contribution__validated
=
False
)
elif
not
current_user
.
is_superuser
:
qs
=
qs
.
exclude
(
Q
(
compoundaction__ppi__contribution__validated
=
False
),
~
Q
(
compoundaction__ppi__contribution__contributor
=
current_user
),
)
# add filters
# add filters
self
.
filter_context
[
self
.
filter_context
[
"
disabled
"
"
disabled
"
...
...
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