Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iric-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
bioinfo_iric
iric-data
Commits
250d9b56
Commit
250d9b56
authored
2 years ago
by
LouisGendron
Browse files
Options
Downloads
Patches
Plain Diff
Add staff user to profiles that can modify a DS
parent
a1dadf63
No related branches found
No related tags found
1 merge request
!98
Resolve "Allow staff user to modify any DS"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
portal/forms.py
+1
-1
1 addition, 1 deletion
portal/forms.py
portal/models.py
+12
-10
12 additions, 10 deletions
portal/models.py
with
13 additions
and
11 deletions
portal/forms.py
+
1
−
1
View file @
250d9b56
...
@@ -280,7 +280,7 @@ class DataSetForm(forms.ModelForm):
...
@@ -280,7 +280,7 @@ class DataSetForm(forms.ModelForm):
is_valid
=
super
().
is_valid
()
is_valid
=
super
().
is_valid
()
if
not
is_valid
:
if
not
is_valid
:
return
is_valid
return
is_valid
elif
self
.
instance
.
id
:
# Apply only to DS update
elif
self
.
instance
.
id
and
self
.
request_profile
:
# Apply only to DS update
is_valid
=
self
.
instance
in
DataSet
.
objects
.
writable_by_profile
(
self
.
request_profile
)
is_valid
=
self
.
instance
in
DataSet
.
objects
.
writable_by_profile
(
self
.
request_profile
)
return
is_valid
return
is_valid
...
...
This diff is collapsed.
Click to expand it.
portal/models.py
+
12
−
10
View file @
250d9b56
...
@@ -307,16 +307,18 @@ class DataSetManager(models.Manager):
...
@@ -307,16 +307,18 @@ class DataSetManager(models.Manager):
Created by user
Created by user
OR accessible by user AND NOT read-only
OR accessible by user AND NOT read-only
"""
"""
return
super
().
get_queryset
().
filter
(
if
profile
.
user
.
is_staff
:
Q
(
created_by
=
profile
)
qs
=
super
().
get_queryset
()
|
(
else
:
(
qs
=
Q
(
created_by
=
profile
)
\
Q
(
share_profiles
=
profile
)
|
(
|
Q
(
share_labs__members
=
profile
)
(
|
Q
(
share_groups__profiles
=
profile
)
Q
(
share_profiles
=
profile
)
)
&
Q
(
read_only
=
False
)
|
Q
(
share_labs__members
=
profile
)
)
|
Q
(
share_groups__profiles
=
profile
)
)
)
&
Q
(
read_only
=
False
)
)
return
qs
class
DataSet
(
models
.
Model
):
class
DataSet
(
models
.
Model
):
...
...
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