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
67d59eef
authored
Feb 11, 2014
by
Őry Máté
Committed by
Guba Sándor
Feb 12, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add groups to user based on saml attrs
parent
36cf540f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
circle/dashboard/models.py
+24
-2
No files found.
circle/dashboard/models.py
View file @
67d59eef
...
...
@@ -53,7 +53,7 @@ class GroupProfile(AclBase):
def
get_or_create_profile
(
self
):
obj
,
created
=
GroupProfile
.
objects
.
get_or_create
(
pk
=
self
.
pk
)
obj
,
created
=
GroupProfile
.
objects
.
get_or_create
(
group_id
=
self
.
pk
)
return
obj
Group
.
profile
=
property
(
get_or_create_profile
)
...
...
@@ -94,7 +94,29 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
else
:
logger
.
debug
(
"org_id of
%
s already added to user
%
s's profile"
,
value
,
sender
.
username
)
return
False
memberatrs
=
getattr
(
settings
,
'SAML_GROUP_ATTRIBUTES'
,
[])
for
group
in
chain
(
*
[
attributes
[
i
]
for
i
in
memberatrs
]):
try
:
g
=
GroupProfile
.
search
(
group
)
except
Group
.
DoesNotExist
:
logger
.
debug
(
'cant find membergroup
%
s'
,
group
)
else
:
logger
.
debug
(
'could find membergroup
%
s (
%
s)'
,
group
,
unicode
(
g
))
g
.
user_set
.
add
(
sender
)
owneratrs
=
getattr
(
settings
,
'SAML_GROUP_OWNER_ATTRIBUTES'
,
[])
for
group
in
chain
(
*
[
attributes
[
i
]
for
i
in
owneratrs
]):
try
:
g
=
GroupProfile
.
search
(
group
)
except
Group
.
DoesNotExist
:
logger
.
debug
(
'cant find ownergroup
%
s'
,
group
)
else
:
logger
.
debug
(
'could find ownergroup
%
s (
%
s)'
,
group
,
unicode
(
g
))
g
.
profile
.
set_level
(
sender
,
'owner'
)
return
False
# User did not change
pre_user_save
.
connect
(
save_org_id
)
...
...
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