Commit 945ae33b authored by Kostas Papadimitriou's avatar Kostas Papadimitriou

astakos: Exclude terminated project entries from api responses

exclude terminated projects both from projects list api and user quotas
list api calls.
parent 30fd1f7f
# Copyright (C) 2010-2014 GRNET S.A. # Copyright (C) 2010-2014 GRNET S.A.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -25,7 +26,7 @@ from django.core.cache import cache ...@@ -25,7 +26,7 @@ from django.core.cache import cache
from astakos.im import settings from astakos.im import settings
from astakos.im import register from astakos.im import register
from astakos.im.quotas import get_user_quotas, service_get_quotas, \ from astakos.im.quotas import get_user_quotas, service_get_quotas, \
service_get_project_quotas, project_ref service_get_project_quotas, project_ref, Project
import astakos.quotaholder_app.exception as qh_exception import astakos.quotaholder_app.exception as qh_exception
import astakos.quotaholder_app.callpoint as qh import astakos.quotaholder_app.callpoint as qh
...@@ -49,6 +50,8 @@ def quotas(request): ...@@ -49,6 +50,8 @@ def quotas(request):
visible_resources = get_visible_resources() visible_resources = get_visible_resources()
resource_names = [r.name for r in visible_resources] resource_names = [r.name for r in visible_resources]
memberships = request.user.projectmembership_set.actually_accepted() memberships = request.user.projectmembership_set.actually_accepted()
memberships = memberships.exclude(project__state__in=Project.SKIP_STATES)
sources = [project_ref(m.project.uuid) for m in memberships] sources = [project_ref(m.project.uuid) for m in memberships]
result = get_user_quotas(request.user, resources=resource_names, result = get_user_quotas(request.user, resources=resource_names,
sources=sources) sources=sources)
......
...@@ -115,7 +115,7 @@ def project_list(request, template_name="im/projects/project_list.html"): ...@@ -115,7 +115,7 @@ def project_list(request, template_name="im/projects/project_list.html"):
query = query & ~Q(Q(is_base=True) & \ query = query & ~Q(Q(is_base=True) & \
~Q(realname="system:%s" % request.user.uuid)) ~Q(realname="system:%s" % request.user.uuid))
query = query & ~Q(state=Project.DELETED) query = query & ~Q(state__in=Project.SKIP_STATES)
mode = "default" mode = "default"
if not request.user.is_project_admin(): if not request.user.is_project_admin():
mode = "related" mode = "related"
......
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