Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
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
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Alsijil
Commits
3d5d957c
Verified
Commit
3d5d957c
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Make permission checks in views.py additive
parent
5b288ced
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!49
Resolve "Add rules and permissions"
Pipeline
#4070
failed
4 years ago
Stage: test
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/alsijil/views.py
+8
-6
8 additions, 6 deletions
aleksis/apps/alsijil/views.py
with
8 additions
and
6 deletions
aleksis/apps/alsijil/views.py
+
8
−
6
View file @
3d5d957c
...
...
@@ -109,9 +109,11 @@ def lesson(
)
# Create a formset that holds all personal notes for all persons in this lesson
persons
=
Person
.
objects
.
all
()
if
not
request
.
user
.
has_perm
(
"
alsijil.view_lesson_personalnote
"
,
lesson_period
):
persons
=
persons
.
filter
(
pk
=
request
.
user
.
person
.
pk
)
persons
=
Person
.
objects
.
filter
(
pk
=
request
.
user
.
person
.
pk
)
else
:
persons
=
Person
.
objects
.
all
()
persons_qs
=
lesson_period
.
get_personal_notes
(
persons
,
wanted_week
)
personal_note_formset
=
PersonalNoteFormSet
(
request
.
POST
or
None
,
queryset
=
persons_qs
,
prefix
=
"
personal_notes
"
...
...
@@ -568,10 +570,10 @@ def overview_person(request: HttpRequest, id_: Optional[int] = None) -> HttpResp
person
.
refresh_from_db
()
allowed_personal_notes
=
person
.
personal
_
note
s
.
all
()
if
not
request
.
user
.
has_perm
(
"
alsijil.view_person_overview_personalnote
"
,
person
)
:
allowed_personal_notes
=
allowed_
personal_notes
.
filter
(
if
request
.
user
.
has_perm
(
"
alsijil.view_person_overview_
personalnote
"
,
person
):
allowed_personal_notes
=
person
.
personal_notes
.
all
()
else
:
allowed_personal_notes
=
person
.
personal_notes
.
filter
(
lesson_period__lesson__groups__owners
=
request
.
user
.
person
)
...
...
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