Commit 167e2faf authored by Olga Brani's avatar Olga Brani
Browse files

Merge branch '0.6.4' of into 0.6.4

parents cdde4aac 1e9df9ae
......@@ -37,12 +37,13 @@ from optparse import make_option
from random import choice
from string import digits, lowercase, uppercase
from uuid import uuid4
from datetime import datetime
from import BaseCommand, CommandError
from django.core.validators import validate_email
from django.core.exceptions import ValidationError
from import AstakosUser, AstakosGroup
from import AstakosUser, AstakosGroup, Membership
from import reserved_email
from ._common import add_user_permission
......@@ -121,7 +122,7 @@ class Command(BaseCommand):
if groupname is not None:
group = AstakosGroup.objects.get(name=groupname)
Membership(group=group, person=user,
self.stdout.write('Group: %s added successfully\n' % groupname)
except AstakosGroup.DoesNotExist, e:
self.stdout.write('Group named %s does not exist\n' % groupname)
......@@ -233,7 +233,6 @@ class AstakosUser(User):
__has_signed_terms = False
__groupnames = []
owner = models.ManyToManyField(AstakosGroup, related_name='owner', null=True)
......@@ -243,9 +242,7 @@ class AstakosUser(User):
def __init__(self, *args, **kwargs):
super(AstakosUser, self).__init__(*args, **kwargs)
self.__has_signed_terms = self.has_signed_terms
self.__groupnames = [ for g in self.astakos_groups.all()]
if not
self.is_active = False
......@@ -308,15 +305,6 @@ class AstakosUser(User):
self.activation_sent = None
super(AstakosUser, self).save(**kwargs)
# set group if does not exist
groupname = 'shibboleth' if self.provider == 'shibboleth' else 'default'
if groupname not in self.__groupnames:
group = AstakosGroup.objects.get(name = groupname)
Membership(group=group, person=self,
except AstakosGroup.DoesNotExist, e:
def renew_token(self):
md5 = hashlib.md5()
......@@ -576,6 +564,17 @@ def superuser_post_save(sender, instance, **kwargs):
post_save.connect(superuser_post_save, sender=User)
def set_default_group(sender, instance, created, **kwargs):
if not created:
default = AstakosGroup.objects.get(name = 'default')
Membership(group=default, person=instance,
except AstakosGroup.DoesNotExist, e:
post_save.connect(set_default_group, sender=AstakosUser)
def get_resources():
# use cache
return Resource.objects.select_related().all()
\ No newline at end of file
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 to comment