Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
NACSOS Core
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MCC APSIS
NACSOS
NACSOS Core
Commits
a76f3477
Commit
a76f3477
authored
2 years ago
by
Tim Repke
Browse files
Options
Downloads
Patches
Plain Diff
fix mypy
parent
3368e513
No related branches found
Branches containing commit
No related tags found
1 merge request
!26
New auth behaviour
Pipeline
#1147
passed
2 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/api/routes/annotations.py
+4
-1
4 additions, 1 deletion
server/api/routes/annotations.py
server/api/routes/auth.py
+10
-1
10 additions, 1 deletion
server/api/routes/auth.py
with
14 additions
and
2 deletions
server/api/routes/annotations.py
+
4
−
1
View file @
a76f3477
...
...
@@ -199,7 +199,7 @@ async def get_assignment(assignment_id: str,
permissions
=
Depends
(
UserPermissionChecker
(
'
annotations_read
'
))):
assignment
=
await
read_assignment
(
assignment_id
=
assignment_id
,
db_engine
=
db_engine
)
if
assignment
.
user_id
!=
permissions
.
user
.
user_id
:
if
(
assignment
is
None
)
or
(
assignment
.
user_id
!=
permissions
.
user
.
user_id
)
:
raise
HTTPException
(
status_code
=
http_status
.
HTTP_401_UNAUTHORIZED
,
detail
=
'
You do not have permission to handle this assignment, as it is not yours!
'
)
...
...
@@ -299,6 +299,9 @@ async def save_annotation(annotated_item: AnnotatedItem,
assignment_db
=
await
read_assignment
(
assignment_id
=
annotated_item
.
assignment
.
assignment_id
,
db_engine
=
db_engine
)
if
assignment_db
is
None
:
raise
MissingInformationError
(
'
No assignment found!
'
)
if
permissions
.
user
.
user_id
==
assignment_db
.
user_id
\
and
str
(
assignment_db
.
assignment_scope_id
)
==
annotated_item
.
assignment
.
assignment_scope_id
\
and
str
(
assignment_db
.
item_id
)
==
annotated_item
.
assignment
.
item_id
\
...
...
This diff is collapsed.
Click to expand it.
server/api/routes/auth.py
+
10
−
1
View file @
a76f3477
...
...
@@ -34,7 +34,16 @@ async def read_users_me(current_user: UserModel = Depends(get_current_active_use
@router.get
(
'
/logout
'
)
async
def
logout
(
current_user
:
UserModel
=
Depends
(
get_current_active_user
)):
await
auth_helper
.
clear_tokens_by_user
(
username
=
current_user
.
username
)
username
=
current_user
.
username
if
username
is
None
:
raise
HTTPException
(
status_code
=
status
.
HTTP_401_UNAUTHORIZED
,
detail
=
'
RuntimeError(empty username)
'
,
headers
=
{
'
WWW-Authenticate
'
:
'
Bearer
'
},
)
await
auth_helper
.
clear_tokens_by_user
(
username
=
username
)
# TODO forgot password route
# TODO update user info (separate route for password updates?) /
...
...
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