Commit 4c67da95 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

astakos: Associate only accepted users with projects

Allow project enrollment and ownership only for users that are accepted,
not just email_verified.

Also change base quota only for accepted users.
parent b3f2dce2
......@@ -380,7 +380,7 @@ def submit_application(app_data, user, project_id=None):
owner = user
owner = AstakosUser.objects.get(uuid=uuid, email_verified=True)
owner = AstakosUser.objects.accepted().get(uuid=uuid)
except AstakosUser.DoesNotExist:
raise faults.BadRequest("User does not exist.")
......@@ -885,7 +885,7 @@ class AddProjectMembersForm(forms.Form):
q = self.cleaned_data.get('q') or ''
users = q.split(',')
users = list(u.strip() for u in users if u)
db_entries = AstakosUser.objects.verified().filter(email__in=users)
db_entries = AstakosUser.objects.accepted().filter(email__in=users)
unknown = list(set(users) - set( for u in db_entries))
if unknown:
raise forms.ValidationError(
......@@ -505,10 +505,10 @@ def remove_membership(memb_id, request_user=None, reason=None):
def enroll_member_by_email(project_id, email, request_user=None, reason=None):
user = AstakosUser.objects.verified().get(email=email)
user = AstakosUser.objects.accepted().get(email=email)
return enroll_member(project_id, user, request_user, reason=reason)
except AstakosUser.DoesNotExist:
raise ProjectConflict(astakos_messages.UNKNOWN_USERS)
raise ProjectConflict(astakos_messages.UNKNOWN_USERS % email)
def enroll_member(project_id, user, request_user=None, reason=None):
......@@ -332,6 +332,9 @@ class Command(BaseCommand):
set_base_quota = options.get('set_base_quota')
if set_base_quota is not None:
if not user.is_accepted():
m = "%s is not an accepted user." % user
raise CommandError(m)
resource, capacity = set_base_quota
self.set_limits([user], resource, capacity, force)
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