SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
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
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
SciPost
SciPost
Commits
eec3f2a9
Commit
eec3f2a9
authored
5 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Debug permissions in apimail
parent
e59dd850
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apimail/managers.py
+1
-1
1 addition, 1 deletion
apimail/managers.py
apimail/permissions.py
+3
-3
3 additions, 3 deletions
apimail/permissions.py
with
4 additions
and
4 deletions
apimail/managers.py
+
1
−
1
View file @
eec3f2a9
...
@@ -36,7 +36,7 @@ class StoredMessageQuerySet(models.QuerySet):
...
@@ -36,7 +36,7 @@ class StoredMessageQuerySet(models.QuerySet):
"""
"""
if
not
user
.
is_authenticated
:
if
not
user
.
is_authenticated
:
return
self
.
none
()
return
self
.
none
()
elif
user
.
is_superuser
or
user
.
is_
admin
:
elif
user
.
is_superuser
or
user
.
is_
staff
:
return
self
return
self
# Filter based on account accesses
# Filter based on account accesses
...
...
This diff is collapsed.
Click to expand it.
apimail/permissions.py
+
3
−
3
View file @
eec3f2a9
...
@@ -14,7 +14,7 @@ class CanHandleComposedMessage(permissions.BasePermission):
...
@@ -14,7 +14,7 @@ class CanHandleComposedMessage(permissions.BasePermission):
"""
"""
def
has_object_permission
(
self
,
request
,
view
,
obj
):
def
has_object_permission
(
self
,
request
,
view
,
obj
):
if
request
.
user
.
is_superuser
or
request
.
user
.
is_
admin
:
if
request
.
user
.
is_superuser
or
request
.
user
.
is_
staff
:
return
True
return
True
return
obj
.
author
==
request
.
user
return
obj
.
author
==
request
.
user
...
@@ -27,7 +27,7 @@ class CanHandleStoredMessage(permissions.BasePermission):
...
@@ -27,7 +27,7 @@ class CanHandleStoredMessage(permissions.BasePermission):
"""
"""
def
has_object_permission
(
self
,
request
,
view
,
obj
):
def
has_object_permission
(
self
,
request
,
view
,
obj
):
if
request
.
user
.
is_superuser
or
request
.
user
.
is_
admin
:
if
request
.
user
.
is_superuser
or
request
.
user
.
is_
staff
:
return
True
return
True
# Check, based on account accesses
# Check, based on account accesses
...
@@ -48,7 +48,7 @@ class CanReadStoredMessage(permissions.BasePermission):
...
@@ -48,7 +48,7 @@ class CanReadStoredMessage(permissions.BasePermission):
"""
"""
def
has_object_permission
(
self
,
request
,
view
,
obj
):
def
has_object_permission
(
self
,
request
,
view
,
obj
):
if
request
.
user
.
is_superuser
or
request
.
user
.
is_
admin
:
if
request
.
user
.
is_superuser
or
request
.
user
.
is_
staff
:
return
True
return
True
# Check, based on account accesses
# Check, based on account accesses
...
...
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