Commit faaeea4c authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Update management commands

to conform with multiple auth providers feature
parent 1f98ad39
......@@ -71,13 +71,12 @@ class Command(BaseCommand):
'token expiration': format_date(user.auth_token_expires),
'invitations': user.invitations,
'invitation level': user.level,
'provider': user.provider,
'providers': user.auth_providers_display,
'verified': format_bool(user.is_verified),
'has_credits': format_bool(user.has_credits),
'groups': [elem.name for elem in user.astakos_groups.all()],
'permissions': [elem.codename for elem in user.user_permissions.all()],
'group_permissions': user.get_group_permissions(),
'third_party_identifier': user.third_party_identifier,
'email_verified': format_bool(user.email_verified),
'username': user.username,
'activation_sent_date': format_date(user.activation_sent),
......
......@@ -68,7 +68,7 @@ class Command(NoArgsCommand):
elif options['pending_send_mail']:
users = users.filter(is_active=False, activation_sent=None)
labels = ('id', 'email', 'real name', 'active', 'admin', 'provider')
labels = ('id', 'email', 'real name', 'active', 'admin', 'providers')
columns = (3, 24, 24, 6, 5, 12, 24)
if not options['csv']:
......@@ -82,7 +82,8 @@ class Command(NoArgsCommand):
active = format_bool(user.is_active)
admin = format_bool(user.is_superuser)
fields = (
id, user.email, user.realname, active, admin, user.provider
id, user.email, user.realname, active, admin, \
user.auth_providers_display
)
if options['csv']:
......
......@@ -692,6 +692,10 @@ class AstakosUser(User):
providers.append(provider)
return providers
@property
def auth_providers_display(self):
return ",".join(map(lambda x:unicode(x), self.auth_providers.active()))
class AstakosUserAuthProviderManager(models.Manager):
......@@ -740,6 +744,14 @@ class AstakosUserAuthProvider(models.Model):
def __repr__(self):
return '<AstakosUserAuthProvider %s:%s>' % (self.module, self.identifier)
def __unicode__(self):
if self.identifier:
return "%s:%s" % (self.module, self.identifier)
if self.auth_backend:
return "%s:%s" % (self.module, self.auth_backend)
return self.module
class Membership(models.Model):
person = models.ForeignKey(AstakosUser)
......
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