Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
89d77c3b
authored
Feb 06, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: create default profile on login
ref #43
parent
e1db1dc1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
+9
-1
circle/dashboard/models.py
+9
-1
No files found.
circle/dashboard/models.py
View file @
89d77c3b
...
...
@@ -2,6 +2,7 @@ from logging import getLogger
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.contrib.auth.signals
import
user_logged_in
from
django.db.models
import
(
Model
,
ForeignKey
,
OneToOneField
,
CharField
,
IntegerField
)
...
...
@@ -29,6 +30,12 @@ class Profile(Model):
instance_limit
=
IntegerField
(
default
=
5
)
def
create_profile
(
sender
,
user
,
request
,
**
kwargs
):
profile
,
created
=
Profile
.
objects
.
get_or_create
(
user
=
user
)
return
created
user_logged_in
.
connect
(
create_profile
)
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
...
...
@@ -54,6 +61,7 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
value
,
sender
.
username
)
return
False
pre_user_save
.
connect
(
save_org_id
,
weak
=
False
)
pre_user_save
.
connect
(
save_org_id
)
else
:
logger
.
debug
(
"Do not register save_org_id to djangosaml2 pre_user_save"
)
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