Commit 09ca6386 authored by Georgios D. Tsoukalas's avatar Georgios D. Tsoukalas
Browse files

astakos-qh-sync: skip email-unverified users

Astakos-qh-sync will create quotas for all eligible users.
Users that have unverified emails are not considered eligible.
When users are activated by an admin via user-update --set-active,
their email is also marked as verified, therefore they become eligible.
parent 12006d0e
......@@ -45,8 +45,16 @@ class Command(NoArgsCommand):
def handle_noargs(self, **options):
try:
register_resources(Resource.objects.all())
register_users(AstakosUser.objects.all())
resources = list(Resource.objects.all())
print("Registering resources")
register_resources(resources)
print("Registering users")
users = list(AstakosUser.objects.verified().all())
if users:
register_users(users)
else:
print(" -> No verified users found.")
except BaseException, e:
logger.exception(e)
raise CommandError("Syncing failed.")
......@@ -252,6 +252,9 @@ class AstakosUserManager(UserManager):
def verified(self):
return self.filter(email_verified=True)
def verified(self):
return self.filter(email_verified=True)
class AstakosUser(User):
"""
......
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