Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
videoag
backend
Commits
c9ddc977
Commit
c9ddc977
authored
1 month ago
by
Simon Künzel
Browse files
Options
Downloads
Patches
Plain Diff
Fix fsmpi authentication
parent
a138463f
No related branches found
No related tags found
No related merge requests found
Pipeline
#7659
failed
1 month ago
Stage: build
Stage: run
Pipeline: backend
#7660
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/src/api/authentication.py
+4
-6
4 additions, 6 deletions
api/src/api/authentication.py
api/tests/routes/object_modifications.py
+1
-1
1 addition, 1 deletion
api/tests/routes/object_modifications.py
with
5 additions
and
7 deletions
api/src/api/authentication.py
+
4
−
6
View file @
c9ddc977
...
@@ -223,6 +223,7 @@ def authenticate_fsmpi(username: str, password: str) -> {}:
...
@@ -223,6 +223,7 @@ def authenticate_fsmpi(username: str, password: str) -> {}:
if
user_db
is
None
:
if
user_db
is
None
:
raise
ApiClientException
(
ERROR_AUTHENTICATION_NOT_AVAILABLE
(
raise
ApiClientException
(
ERROR_AUTHENTICATION_NOT_AVAILABLE
(
"
Site is read-only and we can not create a new account for you in the database
"
))
"
Site is read-only and we can not create a new account for you in the database
"
))
api_session
.
set_user
(
user_db
)
else
:
else
:
def
_trans
(
session
:
SessionDb
):
def
_trans
(
session
:
SessionDb
):
user_db
=
session
.
scalar
(
User
.
sudo_select
().
where
(
User
.
handle
==
user_handle
))
user_db
=
session
.
scalar
(
User
.
sudo_select
().
where
(
User
.
handle
==
user_handle
))
...
@@ -241,13 +242,10 @@ def authenticate_fsmpi(username: str, password: str) -> {}:
...
@@ -241,13 +242,10 @@ def authenticate_fsmpi(username: str, password: str) -> {}:
user_db
.
full_name
=
full_name
user_db
.
full_name
=
full_name
user_db
.
display_name
=
display_name
user_db
.
display_name
=
display_name
user_db
.
email
=
email
user_db
.
email
=
email
api_session
.
set_user
(
user_db
)
session
.
commit
()
database
.
execute_write_transaction_and_commit
(
_trans
)
session
.
expunge_all
()
return
user_db
user_db
=
database
.
execute_write_transaction
(
_trans
)
api_session
.
set_user
(
user_db
)
api_session
.
csrf_token
=
""
.
join
(
api_session
.
csrf_token
=
""
.
join
(
secrets
.
choice
(
string
.
ascii_letters
+
string
.
digits
)
for
_
in
range
(
64
))
secrets
.
choice
(
string
.
ascii_letters
+
string
.
digits
)
for
_
in
range
(
64
))
api_session
.
permanent
=
True
api_session
.
permanent
=
True
...
...
This diff is collapsed.
Click to expand it.
api/tests/routes/object_modifications.py
+
1
−
1
View file @
c9ddc977
...
@@ -1502,7 +1502,7 @@ class ObjectModificationsTest(ApiTest):
...
@@ -1502,7 +1502,7 @@ class ObjectModificationsTest(ApiTest):
f
"
/object_management/course/
{
id
}
/configuration
"
,
f
"
/object_management/course/
{
id
}
/configuration
"
,
use_moderator_login
=
True
,
use_moderator_login
=
True
,
)[
1
]
)[
1
]
self
.
assert_field_
has_
value
(
config
,
"
responsible_users_ids
"
,
[
42
,
43
]
)
self
.
assert
Equal
(
set
(
self
.
get
_field_value
(
config
,
"
responsible_users_ids
"
))
,
{
42
,
43
}
)
self
.
do_json_request
(
self
.
do_json_request
(
"
GET
"
,
"
GET
"
,
f
"
/course/
{
id
}
"
,
f
"
/course/
{
id
}
"
,
...
...
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