X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fmanagementtabrequests.py;h=6e37f1d4b0ee4dd58dc9078599f512b8193dde02;hb=af8309c2b65c819b5963565ccac2ff35cddec265;hp=f2cea92697c832c0f6a698c631eff76af798ff5a;hpb=d81f5f5ca87b6eba05adb93cd27ac3c9952cc294;p=unfold.git diff --git a/portal/managementtabrequests.py b/portal/managementtabrequests.py index f2cea926..6e37f1d4 100644 --- a/portal/managementtabrequests.py +++ b/portal/managementtabrequests.py @@ -7,13 +7,13 @@ from manifoldapi.manifoldapi import execute_query from django.views.generic.base import TemplateView from unfold.loginrequired import LoginRequiredView -from django.http import HttpResponse -from django.shortcuts import render +from django.http import HttpResponse +from django.shortcuts import render -from manifold.core.query import Query, AnalyzedQuery -from manifoldapi.manifoldapi import execute_query +from manifold.core.query import Query, AnalyzedQuery +from manifoldapi.manifoldapi import execute_query -from portal.actions import get_requests +from portal.actions import get_requests from myslice.theme import ThemeView @@ -22,7 +22,7 @@ import json class ManagementRequestsView (LoginRequiredView, ThemeView): template_name = "management-tab-requests.html" - def get(self, request): + def get_context_data(self, **kwargs): ctx_my_authorities = {} ctx_delegation_authorities = {} @@ -31,7 +31,7 @@ class ManagementRequestsView (LoginRequiredView, ThemeView): # The user need to be logged in - if (request.user): + if (self.request.user): user_query = Query().get('local:user').filter_by('email', '==', self.request.user.email).select('user_id') user, = execute_query(self.request, user_query) @@ -133,27 +133,50 @@ class ManagementRequestsView (LoginRequiredView, ThemeView): if auth_hrn in pi_expired_credential_authorities: r['allowed'] = 'expired' if 'allowed' not in r: - r['allowed'] = 'denied' - + ## TEMP FIX for allowing new authority registration + #r['allowed'] = 'denied' + r['allowed'] = 'allowed' if not auth_hrn in dest: dest[auth_hrn] = [] - dest[auth_hrn].append(request) + dest[auth_hrn].append(r) - env = {} - env['my_authorities'] = ctx_my_authorities - env['sub_authorities'] = ctx_sub_authorities - env['delegation_authorities'] = ctx_delegation_authorities +# env = {} +# env['my_authorities'] = ctx_my_authorities +# env['sub_authorities'] = ctx_sub_authorities +# env['delegation_authorities'] = ctx_delegation_authorities +# +# # XXX This is repeated in all pages +# # more general variables expected in the template +# # the menu items on the top +# #env['topmenu_items'] = topmenu_items_live('Validation', page) +# # so we can sho who is logged +# env['username'] = request.user +# env['pi'] = "is_pi" +# env['theme'] = self.theme +# env['section'] = "Requests" + + context = super(ManagementRequestsView, self).get_context_data(**kwargs) + print "testing" + print ctx_my_authorities + context['my_authorities'] = ctx_my_authorities + context['sub_authorities'] = ctx_sub_authorities + context['delegation_authorities'] = ctx_delegation_authorities # XXX This is repeated in all pages # more general variables expected in the template + context['title'] = 'Test view that combines various plugins' # the menu items on the top - #env['topmenu_items'] = topmenu_items_live('Validation', page) + #context['topmenu_items'] = topmenu_items_live('Validation', page) # so we can sho who is logged - env['username'] = request.user - env['pi'] = "is_pi" - env['theme'] = self.theme - env['section'] = "Requests" - - return render_to_response(self.template, env, context_instance=RequestContext(request)) + context['username'] = self.request.user + context['pi'] = "is_pi" + context['theme'] = self.theme + context['section'] = "Requests" + # XXX We need to prepare the page for queries + #context.update(page.prelude_env()) + + return context + + #return render_to_response(self.template, env, context_instance=RequestContext(request))