Commit 25db6c82 by Czémán Arnold

Merge branch 'issue_494' into 'master'

Upgrade Django 1.11 fix

See merge request !396
parents 53dbd80b 330ddc77
Pipeline #551 passed with stage
in 0 seconds
...@@ -500,6 +500,10 @@ if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE': ...@@ -500,6 +500,10 @@ if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE':
'metadata': {'local': [remote_metadata], }, 'metadata': {'local': [remote_metadata], },
'key_file': join(SITE_ROOT, 'samlcert.key'), # private part 'key_file': join(SITE_ROOT, 'samlcert.key'), # private part
'cert_file': join(SITE_ROOT, 'samlcert.pem'), # public 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: try:
SAML_CONFIG += loads(get_env_variable('DJANGO_SAML_SETTINGS')) SAML_CONFIG += loads(get_env_variable('DJANGO_SAML_SETTINGS'))
......
...@@ -89,7 +89,7 @@ if settings.ADMIN_ENABLED: ...@@ -89,7 +89,7 @@ if settings.ADMIN_ENABLED:
if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE': if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE':
urlpatterns += [ urlpatterns += [
(r'^saml2/', include('djangosaml2.urls')), url(r'^saml2/', include('djangosaml2.urls')),
] ]
handler500 = 'common.views.handler500' handler500 = 'common.views.handler500'
......
...@@ -1554,6 +1554,8 @@ vm_search_choices = ( ...@@ -1554,6 +1554,8 @@ vm_search_choices = (
class VmListSearchForm(forms.Form): class VmListSearchForm(forms.Form):
use_required_attribute = False
s = forms.CharField(widget=forms.TextInput(attrs={ s = forms.CharField(widget=forms.TextInput(attrs={
'class': "form-control input-tags", 'class': "form-control input-tags",
'placeholder': _("Search...") 'placeholder': _("Search...")
...@@ -1578,6 +1580,8 @@ class VmListSearchForm(forms.Form): ...@@ -1578,6 +1580,8 @@ class VmListSearchForm(forms.Form):
class TemplateListSearchForm(forms.Form): class TemplateListSearchForm(forms.Form):
use_required_attribute = False
s = forms.CharField(widget=forms.TextInput(attrs={ s = forms.CharField(widget=forms.TextInput(attrs={
'class': "form-control input-tags", 'class': "form-control input-tags",
'placeholder': _("Search...") 'placeholder': _("Search...")
...@@ -1597,6 +1601,8 @@ class TemplateListSearchForm(forms.Form): ...@@ -1597,6 +1601,8 @@ class TemplateListSearchForm(forms.Form):
class UserListSearchForm(forms.Form): class UserListSearchForm(forms.Form):
use_required_attribute = False
s = forms.CharField(widget=forms.TextInput(attrs={ s = forms.CharField(widget=forms.TextInput(attrs={
'class': "form-control input-tags", 'class': "form-control input-tags",
'placeholder': _("Search...") 'placeholder': _("Search...")
......
...@@ -347,9 +347,8 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'): ...@@ -347,9 +347,8 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
logger.debug("Register save_org_id to djangosaml2 pre_user_save") logger.debug("Register save_org_id to djangosaml2 pre_user_save")
from djangosaml2.signals import pre_user_save from djangosaml2.signals import pre_user_save
def save_org_id(sender, **kwargs): def save_org_id(sender, instance, attributes, **kwargs):
logger.debug("save_org_id called by %s", sender.username) logger.debug("save_org_id called by %s", instance.username)
attributes = kwargs.pop('attributes')
atr = settings.SAML_ORG_ID_ATTRIBUTE atr = settings.SAML_ORG_ID_ATTRIBUTE
try: try:
value = attributes[atr][0].upper() value = attributes[atr][0].upper()
...@@ -357,19 +356,19 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'): ...@@ -357,19 +356,19 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
value = None value = None
logger.info("save_org_id couldn't find attribute. %s", unicode(e)) logger.info("save_org_id couldn't find attribute. %s", unicode(e))
if sender.pk is None: if instance.pk is None:
sender.save() instance.save()
logger.debug("save_org_id saved user %s", unicode(sender)) 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: if created or profile.org_id != value:
logger.info("org_id of %s added to user %s's profile", logger.info("org_id of %s added to user %s's profile",
value, sender.username) value, instance.username)
profile.org_id = value profile.org_id = value
profile.save() profile.save()
else: else:
logger.debug("org_id of %s already added to user %s's profile", 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', []) memberatrs = getattr(settings, 'SAML_GROUP_ATTRIBUTES', [])
for group in chain(*[attributes[i] for group in chain(*[attributes[i]
for i in memberatrs if i in attributes]): for i in memberatrs if i in attributes]):
...@@ -380,10 +379,10 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'): ...@@ -380,10 +379,10 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
else: else:
logger.debug('could find membergroup %s (%s)', logger.debug('could find membergroup %s (%s)',
group, unicode(g)) group, unicode(g))
g.user_set.add(sender) g.user_set.add(instance)
for i in FutureMember.objects.filter(org_id__iexact=value): for i in FutureMember.objects.filter(org_id__iexact=value):
i.group.user_set.add(sender) i.group.user_set.add(instance)
i.delete() i.delete()
owneratrs = getattr(settings, 'SAML_GROUP_OWNER_ATTRIBUTES', []) owneratrs = getattr(settings, 'SAML_GROUP_OWNER_ATTRIBUTES', [])
...@@ -396,7 +395,7 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'): ...@@ -396,7 +395,7 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
else: else:
logger.debug('could find ownergroup %s (%s)', logger.debug('could find ownergroup %s (%s)',
group, unicode(g)) group, unicode(g))
g.profile.set_level(sender, 'owner') g.profile.set_level(instance, 'owner')
return False # User did not change return False # User did not change
......
...@@ -4,7 +4,7 @@ arrow==0.7.0 ...@@ -4,7 +4,7 @@ arrow==0.7.0
billiard==3.3.0.20 billiard==3.3.0.20
bpython==0.14.1 bpython==0.14.1
celery==3.1.18 celery==3.1.18
Django==1.11.3 Django==1.11.6
django-appconf==1.0.2 django-appconf==1.0.2
django-autocomplete-light==3.2.9 django-autocomplete-light==3.2.9
django-braces==1.11.0 django-braces==1.11.0
...@@ -15,7 +15,7 @@ django-sizefield==0.9.1 ...@@ -15,7 +15,7 @@ django-sizefield==0.9.1
django-statici18n==1.4.0 django-statici18n==1.4.0
django-tables2==1.10.0 django-tables2==1.10.0
django-taggit==0.22.1 django-taggit==0.22.1
djangosaml2==0.16.0 djangosaml2==0.16.10
git+https://git.ik.bme.hu/circle/django-sshkey.git git+https://git.ik.bme.hu/circle/django-sshkey.git
docutils==0.12 docutils==0.12
Jinja2==2.7.3 Jinja2==2.7.3
...@@ -43,3 +43,5 @@ pika==0.9.14 ...@@ -43,3 +43,5 @@ pika==0.9.14
Fabric==1.10.1 Fabric==1.10.1
lxml==3.4.4 lxml==3.4.4
python-memcached==1.58 python-memcached==1.58
enum34==1.1.6
ipaddress==1.0.18
...@@ -7,5 +7,5 @@ django-nose==1.4.4 ...@@ -7,5 +7,5 @@ django-nose==1.4.4
nose==1.3.7 nose==1.3.7
nose-exclude==0.5.0 nose-exclude==0.5.0
selenium==2.45.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 -e git+https://github.com/kmmbvnr/django-jenkins.git@019774dc2f668bc66b66f90f97eb8e14ae9566a4#egg=django_jenkins-dev
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment