SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
119
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
7e26e01a
Commit
7e26e01a
authored
2 weeks ago
by
George Katsikas
Browse files
Options
Downloads
Patches
Plain Diff
fix:
fix wrong add notes permission check
parent
e6706632
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scipost_django/pins/views.py
+4
-5
4 additions, 5 deletions
scipost_django/pins/views.py
with
4 additions
and
5 deletions
scipost_django/pins/views.py
+
4
−
5
View file @
7e26e01a
...
...
@@ -6,12 +6,13 @@ from django.db.models import Q
from
django.shortcuts
import
HttpResponse
from
django.template.response
import
TemplateResponse
from
scipost.permissions
import
HTMXResponse
from
scipost.permissions
import
HTMXResponse
,
permission_required_htmx
from
.models
import
Note
from
.forms
import
NoteForm
@permission_required_htmx
(
"
scipost.can_add_notes
"
)
def
_hx_note_create_form
(
request
,
regarding_content_type
,
regarding_object_id
):
regarding_content_type
=
ContentType
.
objects
.
get_for_id
(
regarding_content_type
)
form
=
NoteForm
(
...
...
@@ -45,9 +46,7 @@ def _hx_note_delete(request, pk):
note
.
delete
()
return
HttpResponse
()
else
:
response
=
HTMXResponse
(
"
You are not the author of this note.
"
,
tag
=
"
danger
"
)
response
=
HTMXResponse
(
"
You are not the author of this note.
"
,
tag
=
"
danger
"
)
response
[
"
HX-Trigger
"
]
=
"
notes-updated
"
return
response
...
...
@@ -62,7 +61,7 @@ def _hx_notes_list(request, regarding_content_type, regarding_object_id):
)
# Handle permission checks for viewing and creating notes
can_create_notes
=
request
.
user
.
has_perm
(
"
pins
.can_add_notes
"
)
can_create_notes
=
request
.
user
.
has_perm
(
"
scipost
.can_add_notes
"
)
# Filter according to the visibility of the notes
notes
=
notes
.
visible_to
(
request
.
user
,
object
.
__class__
)
...
...
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