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
1783e32e
Commit
1783e32e
authored
1 year ago
by
Tim Repke
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into 'production'
fix mypy flake See merge request
!42
parents
4eabff92
84bcdbbb
No related branches found
No related tags found
1 merge request
!42
fix mypy flake
Pipeline
#1451
passed
1 year ago
Stage: build
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
server/api/routes/annotations.py
+2
-3
2 additions, 3 deletions
server/api/routes/annotations.py
server/api/routes/auth.py
+2
-2
2 additions, 2 deletions
server/api/routes/auth.py
server/api/routes/users.py
+7
-3
7 additions, 3 deletions
server/api/routes/users.py
with
11 additions
and
8 deletions
server/api/routes/annotations.py
+
2
−
3
View file @
1783e32e
...
...
@@ -2,16 +2,15 @@ import uuid
from
typing
import
TYPE_CHECKING
from
pydantic
import
BaseModel
from
sqlalchemy
import
select
,
asc
,
join
,
and_
,
text
from
sqlalchemy
import
select
,
text
from
sqlalchemy.orm
import
load_only
from
sqlalchemy.dialects.postgresql
import
json
from
fastapi
import
APIRouter
,
Depends
,
HTTPException
,
status
as
http_status
,
Query
from
nacsos_data.db.schemas
import
\
BotAnnotationMetaData
,
\
AssignmentScope
,
\
User
,
\
Annotation
,
Assignment
Annotation
from
nacsos_data.models.annotations
import
\
AnnotationSchemeModel
,
\
AssignmentScopeModel
,
\
...
...
This diff is collapsed.
Click to expand it.
server/api/routes/auth.py
+
2
−
2
View file @
1783e32e
...
...
@@ -2,15 +2,15 @@ from typing import TYPE_CHECKING
from
fastapi
import
APIRouter
,
Depends
from
fastapi.security
import
OAuth2PasswordRequestForm
from
nacsos_data.db.schemas.users
import
AuthToken
from
sqlalchemy
import
select
from
nacsos_data.db.schemas.users
import
AuthToken
from
nacsos_data.models.users
import
UserModel
,
AuthTokenModel
from
server.api.errors
import
NoDataForKeyError
from
server.util.security
import
get_current_active_user
,
auth_helper
,
InvalidCredentialsError
,
NotAuthenticated
from
server.util.logging
import
get_logger
from
server
import
db_engine
from
server
.data
import
db_engine
if
TYPE_CHECKING
:
from
sqlalchemy.ext.asyncio
import
AsyncSession
# noqa F401
...
...
This diff is collapsed.
Click to expand it.
server/api/routes/users.py
+
7
−
3
View file @
1783e32e
from
typing
import
TYPE_CHECKING
import
uuid
from
fastapi
import
APIRouter
,
Depends
,
Query
,
HTTPException
,
status
as
http_status
from
fastapi
import
APIRouter
,
Depends
,
Query
from
nacsos_data.models.users
import
UserModel
,
UserInDBModel
,
UserBaseModel
from
nacsos_data.util.auth
import
UserPermissions
...
...
@@ -82,7 +81,12 @@ async def save_user_self(user: UserInDBModel | UserModel,
raise
UserPermissionError
(
'
This is not you!
'
)
async
with
db_engine
.
session
()
as
session
:
# type: AsyncSession
user_db
:
User
|
None
=
(
await
session
.
scalars
(
select
(
User
).
where
(
User
.
user_id
==
str
(
user
.
user_id
)))).
one_or_none
()
user_db
:
User
|
None
=
(
await
session
.
scalars
(
select
(
User
)
.
where
(
User
.
user_id
==
str
(
current_user
.
user_id
)))
).
one_or_none
()
if
user_db
is
None
:
raise
DataNotFoundWarning
(
'
User does not exist (this error should never happen)!
'
)
password
:
str
|
None
=
getattr
(
user
,
'
password
'
,
None
)
if
password
is
not
None
:
...
...
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