Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
compendium-v2
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
geant-swd
compendium-v2
Commits
83c461b9
Commit
83c461b9
authored
1 year ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
be explicit
parent
8052422e
No related branches found
No related tags found
1 merge request
!76
Comp 282 add observer role
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compendium_v2/routes/response.py
+9
-3
9 additions, 3 deletions
compendium_v2/routes/response.py
with
9 additions
and
3 deletions
compendium_v2/routes/response.py
+
9
−
3
View file @
83c461b9
...
@@ -91,13 +91,19 @@ def check_access_nren_read(user: User, nren: str) -> bool:
...
@@ -91,13 +91,19 @@ def check_access_nren_read(user: User, nren: str) -> bool:
def
check_access_nren_write
(
user
:
User
,
nren
:
str
)
->
bool
:
def
check_access_nren_write
(
user
:
User
,
nren
:
str
)
->
bool
:
if
not
check_access_nren_read
(
user
,
nren
):
if
not
check_access_nren_read
(
user
,
nren
):
# if you can't read it, you definitely shouldn't write to it
return
False
return
False
if
user
.
is_observer
:
if
user
.
is_observer
:
# observers can't edit their own nrens either!
# observers can't edit their own nrens either!
return
False
return
False
# admins can edit all nrens
if
user
.
is_admin
:
# users can edit their own nrens
# admins can edit all nrens
return
True
return
True
if
nren
==
user
.
nren
:
# users can edit for the nren they are assigned to
return
True
return
False
@routes.route
(
'
/try/<int:year>
'
,
methods
=
[
'
GET
'
])
@routes.route
(
'
/try/<int:year>
'
,
methods
=
[
'
GET
'
])
...
...
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