Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
94d421a9
authored
Feb 06, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix save_org_id logic
parent
c6f318d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
circle/dashboard/models.py
+8
-2
No files found.
circle/dashboard/models.py
View file @
94d421a9
...
...
@@ -30,10 +30,16 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
logger
.
debug
(
"Register save_org_id to djangosaml2 pre_user_save"
)
from
djangosaml2.signals
import
pre_user_save
def
save_org_id
(
sender
,
attributes
,
user_modified
):
def
save_org_id
(
sender
,
**
kwargs
):
logger
.
debug
(
"save_org_id called by
%
s"
,
sender
.
username
)
attributes
=
kwargs
.
pop
(
'attributes'
)
atr
=
settings
.
SAML_ORG_ID_ATTRIBUTE
value
=
attributes
[
atr
]
try
:
value
=
attributes
[
atr
][
0
]
except
Exception
as
e
:
value
=
None
logger
.
info
(
"save_org_id couldn't find attribute.
%
s"
,
unicode
(
e
))
profile
,
created
=
Profile
.
objects
.
get_or_create
(
user
=
sender
)
if
created
or
profile
.
org_id
!=
value
:
logger
.
info
(
"org_id of
%
s added to user
%
s's profile"
,
...
...
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