Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c92dd151
authored
Oct 12, 2017
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade djangosaml2
parent
df34da69
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
16 deletions
+21
-16
circle/circle/settings/base.py
+4
-0
circle/circle/urls.py
+1
-1
circle/dashboard/models.py
+11
-12
requirements/base.txt
+4
-2
requirements/test.txt
+1
-1
No files found.
circle/circle/settings/base.py
View file @
c92dd151
...
...
@@ -500,6 +500,10 @@ if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE':
'metadata'
:
{
'local'
:
[
remote_metadata
],
},
'key_file'
:
join
(
SITE_ROOT
,
'samlcert.key'
),
# private part
'cert_file'
:
join
(
SITE_ROOT
,
'samlcert.pem'
),
# public part
'encryption_keypairs'
:
[{
'key_file'
:
join
(
SITE_ROOT
,
'samlcert.key'
),
# private part
'cert_file'
:
join
(
SITE_ROOT
,
'samlcert.pem'
),
# public part
}]
}
try
:
SAML_CONFIG
+=
loads
(
get_env_variable
(
'DJANGO_SAML_SETTINGS'
))
...
...
circle/circle/urls.py
View file @
c92dd151
...
...
@@ -89,7 +89,7 @@ if settings.ADMIN_ENABLED:
if
get_env_variable
(
'DJANGO_SAML'
,
'FALSE'
)
==
'TRUE'
:
urlpatterns
+=
[
(
r'^saml2/'
,
include
(
'djangosaml2.urls'
)),
url
(
r'^saml2/'
,
include
(
'djangosaml2.urls'
)),
]
handler500
=
'common.views.handler500'
...
...
circle/dashboard/models.py
View file @
c92dd151
...
...
@@ -347,9 +347,8 @@ 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
,
**
kwargs
):
logger
.
debug
(
"save_org_id called by
%
s"
,
sender
.
username
)
attributes
=
kwargs
.
pop
(
'attributes'
)
def
save_org_id
(
sender
,
instance
,
attributes
,
**
kwargs
):
logger
.
debug
(
"save_org_id called by
%
s"
,
instance
.
username
)
atr
=
settings
.
SAML_ORG_ID_ATTRIBUTE
try
:
value
=
attributes
[
atr
][
0
]
.
upper
()
...
...
@@ -357,19 +356,19 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
value
=
None
logger
.
info
(
"save_org_id couldn't find attribute.
%
s"
,
unicode
(
e
))
if
sender
.
pk
is
None
:
sender
.
save
()
logger
.
debug
(
"save_org_id saved user
%
s"
,
unicode
(
sender
))
if
instance
.
pk
is
None
:
instance
.
save
()
logger
.
debug
(
"save_org_id saved user
%
s"
,
unicode
(
instance
))
profile
,
created
=
Profile
.
objects
.
get_or_create
(
user
=
sender
)
profile
,
created
=
Profile
.
objects
.
get_or_create
(
user
=
instance
)
if
created
or
profile
.
org_id
!=
value
:
logger
.
info
(
"org_id of
%
s added to user
%
s's profile"
,
value
,
sender
.
username
)
value
,
instance
.
username
)
profile
.
org_id
=
value
profile
.
save
()
else
:
logger
.
debug
(
"org_id of
%
s already added to user
%
s's profile"
,
value
,
sender
.
username
)
value
,
instance
.
username
)
memberatrs
=
getattr
(
settings
,
'SAML_GROUP_ATTRIBUTES'
,
[])
for
group
in
chain
(
*
[
attributes
[
i
]
for
i
in
memberatrs
if
i
in
attributes
]):
...
...
@@ -380,10 +379,10 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
else
:
logger
.
debug
(
'could find membergroup
%
s (
%
s)'
,
group
,
unicode
(
g
))
g
.
user_set
.
add
(
sender
)
g
.
user_set
.
add
(
instance
)
for
i
in
FutureMember
.
objects
.
filter
(
org_id__iexact
=
value
):
i
.
group
.
user_set
.
add
(
sender
)
i
.
group
.
user_set
.
add
(
instance
)
i
.
delete
()
owneratrs
=
getattr
(
settings
,
'SAML_GROUP_OWNER_ATTRIBUTES'
,
[])
...
...
@@ -396,7 +395,7 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
else
:
logger
.
debug
(
'could find ownergroup
%
s (
%
s)'
,
group
,
unicode
(
g
))
g
.
profile
.
set_level
(
sender
,
'owner'
)
g
.
profile
.
set_level
(
instance
,
'owner'
)
return
False
# User did not change
...
...
requirements/base.txt
View file @
c92dd151
...
...
@@ -4,7 +4,7 @@ arrow==0.7.0
billiard==3.3.0.20
bpython==0.14.1
celery==3.1.18
Django==1.11.
3
Django==1.11.
6
django-appconf==1.0.2
django-autocomplete-light==3.2.9
django-braces==1.11.0
...
...
@@ -15,7 +15,7 @@ django-sizefield==0.9.1
django-statici18n==1.4.0
django-tables2==1.10.0
django-taggit==0.22.1
djangosaml2==0.16.0
djangosaml2==0.16.
1
0
git+https://git.ik.bme.hu/circle/django-sshkey.git
docutils==0.12
Jinja2==2.7.3
...
...
@@ -43,3 +43,5 @@ pika==0.9.14
Fabric==1.10.1
lxml==3.4.4
python-memcached==1.58
enum34==1.1.6
ipaddress==1.0.18
requirements/test.txt
View file @
c92dd151
...
...
@@ -7,5 +7,5 @@ django-nose==1.4.4
nose==1.3.7
nose-exclude==0.5.0
selenium==2.45.0
selenose==1.3
#
selenose==1.3
-e git+https://github.com/kmmbvnr/django-jenkins.git@019774dc2f668bc66b66f90f97eb8e14ae9566a4#egg=django_jenkins-dev
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