Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
test-it
test_oauth2_django
Commits
fab7b807
Unverified
Commit
fab7b807
authored
May 01, 2020
by
Gehmis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle user/group renames
parent
bc07ba5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
test_oauth/backend.py
test_oauth/backend.py
+9
-4
No files found.
test_oauth/backend.py
View file @
fab7b807
...
...
@@ -24,9 +24,11 @@ class TESTOAuth2Backend(ModelBackend):
self
.
run_verifiers
(
profile
)
if
getattr
(
settings
,
'TEST_OAUTH_RESPECT_ID'
,
False
):
user
,
_
=
get_user_model
().
objects
.
get
_or_create
(
user
,
_
=
get_user_model
().
objects
.
update
_or_create
(
pk
=
profile
[
'id'
],
username
=
profile
[
'username'
]
defaults
=
{
'username'
:
profile
[
'username'
]
}
)
else
:
user
,
_
=
get_user_model
().
objects
.
get_or_create
(
...
...
@@ -80,8 +82,11 @@ class TESTOAuth2Backend(ModelBackend):
user
.
groups
.
clear
()
for
g
in
groups
:
group
,
_
=
Group
.
objects
.
get_or_create
(
id
=
g
[
'id'
],
name
=
g
[
'name'
]
group
,
_
=
Group
.
objects
.
update_or_create
(
id
=
g
[
'id'
],
defaults
=
{
'name'
:
g
[
'name'
]
}
)
user
.
groups
.
add
(
group
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment