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
b4aca32d
authored
Sep 11, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: create user profile on creation
closes #269
parent
65fd2ea6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
circle/dashboard/models.py
+6
-2
circle/dashboard/views.py
+2
-1
No files found.
circle/dashboard/models.py
View file @
b4aca32d
...
...
@@ -261,7 +261,7 @@ def get_or_create_profile(self):
Group
.
profile
=
property
(
get_or_create_profile
)
def
create_profile
(
sender
,
user
,
request
,
**
kwargs
):
def
create_profile
(
user
):
if
not
user
.
pk
:
return
False
profile
,
created
=
Profile
.
objects
.
get_or_create
(
user
=
user
)
...
...
@@ -272,7 +272,11 @@ def create_profile(sender, user, request, **kwargs):
logger
.
exception
(
"Can't create user
%
s"
,
unicode
(
user
))
return
created
user_logged_in
.
connect
(
create_profile
)
def
create_profile_hook
(
sender
,
user
,
request
,
**
kwargs
):
return
create_profile
(
user
)
user_logged_in
.
connect
(
create_profile_hook
)
if
hasattr
(
settings
,
'SAML_ORG_ID_ATTRIBUTE'
):
logger
.
debug
(
"Register save_org_id to djangosaml2 pre_user_save"
)
...
...
circle/dashboard/views.py
View file @
b4aca32d
...
...
@@ -91,7 +91,7 @@ from vm.models import (
from
storage.models
import
Disk
from
firewall.models
import
Vlan
,
Host
,
Rule
from
.models
import
(
Favourite
,
Profile
,
GroupProfile
,
FutureMember
,
ConnectCommand
)
ConnectCommand
,
create_profile
)
from
.store_api
import
Store
,
NoStoreException
,
NotOkException
...
...
@@ -3288,6 +3288,7 @@ class UserCreationView(LoginRequiredMixin, PermissionRequiredMixin,
self
.
get_group
(
group_pk
)
ret
=
super
(
UserCreationView
,
self
)
.
post
(
*
args
,
**
kwargs
)
if
self
.
object
:
create_profile
(
self
.
object
)
self
.
object
.
groups
.
add
(
self
.
group
)
return
redirect
(
reverse
(
'dashboard.views.group-detail'
,
args
=
[
group_pk
]))
...
...
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