Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iric-data
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
Container Registry
Model registry
Operate
Environments
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
bioinfo_iric
iric-data
Commits
6d0402aa
Commit
6d0402aa
authored
4 years ago
by
Jean-Philippe Laverdure
Browse files
Options
Downloads
Plain Diff
Merge branch '111-oauth' into 'master'
Fetch and set samaccountname See merge request
!56
parents
c4357734
9d8ed679
No related branches found
No related tags found
1 merge request
!56
Fetch and set samaccountname
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
iric_data/settings.py
+1
-0
1 addition, 0 deletions
iric_data/settings.py
portal/views/secure/login_success.py
+9
-2
9 additions, 2 deletions
portal/views/secure/login_success.py
with
10 additions
and
2 deletions
iric_data/settings.py
+
1
−
0
View file @
6d0402aa
...
@@ -153,6 +153,7 @@ SOCIAL_AUTH_PIPELINE = (
...
@@ -153,6 +153,7 @@ SOCIAL_AUTH_PIPELINE = (
'
social_core.pipeline.social_auth.associate_user
'
,
'
social_core.pipeline.social_auth.associate_user
'
,
'
social_core.pipeline.social_auth.load_extra_data
'
,
'
social_core.pipeline.social_auth.load_extra_data
'
,
'
social_core.pipeline.user.user_details
'
,
'
social_core.pipeline.user.user_details
'
,
# 'social_core.pipeline.debug.debug'
)
)
SOCIAL_AUTH_URL_NAMESPACE
=
'
social
'
SOCIAL_AUTH_URL_NAMESPACE
=
'
social
'
...
...
This diff is collapsed.
Click to expand it.
portal/views/secure/login_success.py
+
9
−
2
View file @
6d0402aa
...
@@ -14,11 +14,16 @@ class LoginSuccess(View):
...
@@ -14,11 +14,16 @@ class LoginSuccess(View):
"""
"""
user
=
self
.
request
.
user
user
=
self
.
request
.
user
azuread_
groups
=
None
azuread_
data
=
{}
try
:
try
:
azuread_
groups
=
user
.
social_auth
.
get
(
provider
=
'
azuread-tenant-oauth2
'
).
extra_data
[
'
groups
'
]
azuread_
data
=
user
.
social_auth
.
get
(
provider
=
'
azuread-tenant-oauth2
'
).
extra_data
except
:
except
:
pass
pass
azuread_groups
=
azuread_data
[
'
groups
'
]
if
'
groups
'
in
azuread_data
else
None
azuread_samaccountname
=
azuread_data
[
'
onPremisesSamAccountName
'
]
if
'
onPremisesSamAccountName
'
in
azuread_data
else
None
if
azuread_samaccountname
and
not
user
.
profile
.
accountname
:
user
.
profile
.
accountname
=
azuread_samaccountname
if
hasattr
(
user
,
'
ldapuser
'
)
or
azuread_groups
:
if
hasattr
(
user
,
'
ldapuser
'
)
or
azuread_groups
:
user
.
profile
.
labs
.
remove
(
*
Lab
.
objects
.
filter
(
ldap__startswith
=
'
iric-
'
))
user
.
profile
.
labs
.
remove
(
*
Lab
.
objects
.
filter
(
ldap__startswith
=
'
iric-
'
))
...
@@ -42,4 +47,6 @@ class LoginSuccess(View):
...
@@ -42,4 +47,6 @@ class LoginSuccess(View):
request
.
session
[
'
active_lab_id
'
]
=
user
.
profile
.
labs
.
first
().
id
request
.
session
[
'
active_lab_id
'
]
=
user
.
profile
.
labs
.
first
().
id
# return redirect('dashboard')
# return redirect('dashboard')
user
.
profile
.
save
()
return
redirect
(
'
dashboard
'
)
return
redirect
(
'
dashboard
'
)
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