X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fviews.py;h=8194ed88b7ef75f6c185e4ace19a34fc84430cd1;hb=8585ac6a787638d9f04c7135c3ba1fe787d3db8d;hp=da6922064d2e2e67849da821360016f900c3363b;hpb=2684c88dbfb1243075bd084ed5296b63dae59ced;p=myslice.git diff --git a/portal/views.py b/portal/views.py index da692206..8194ed88 100644 --- a/portal/views.py +++ b/portal/views.py @@ -24,11 +24,11 @@ import json from django.http import HttpResponseRedirect, HttpResponse -from django.views.generic.base import TemplateView from django.shortcuts import render from django.template.loader import render_to_string -from ui.topmenu import topmenu_items, the_user +from unfold.loginrequired import FreeAccessView +from ui.topmenu import topmenu_items_live, the_user from portal.event import Event # presview is put in observation for now @@ -49,7 +49,7 @@ from unfold.page import Page # all the other ones have now migrated into separate classes/files for more convenience # I'm leaving these ones here for now as I could not exactly figure what the purpose was # (i.e. what the correct name should be, as presviewview was a bit cryptic) -class PresViewView(TemplateView): +class PresViewView(FreeAccessView): template_name = "view-unfold1.html" def get_context_data(self, **kwargs): @@ -62,13 +62,13 @@ class PresViewView(TemplateView): context = super(PresViewView, self).get_context_data(**kwargs) #context['ALL_STATIC'] = "all_static" - context['unfold1_main'] = pres_view.render(self.request) + context['unfold_main'] = pres_view.render(self.request) # 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 - context['topmenu_items'] = topmenu_items('PresView', self.request) + context['topmenu_items'] = topmenu_items_live('PresView', page) # so we can sho who is logged context['username'] = the_user(self.request) @@ -222,7 +222,7 @@ def pres_view_static(request, constraints, id): json_answer = json.dumps(cmd) return HttpResponse (json_answer, mimetype="application/json") -class ValidatePendingView(TemplateView): +class ValidatePendingView(FreeAccessView): template_name = "validate_pending.html" def get_context_data(self, **kwargs): @@ -272,7 +272,14 @@ class ValidatePendingView(TemplateView): platform_ids.append(sfa_platform['platform_id']) print "W: Hardcoding platform myslice" - platform_ids.append(5); + # There has been a tweak on how new platforms are referencing a + # so-called 'myslice' platform for storing authentication tokens. + # XXX This has to be removed in final versions. + myslice_platforms_query = Query().get('local:platform').filter_by('platform', '==', 'myslice').select('platform_id') + myslice_platforms = execute_query(self.request, myslice_platforms_query) + if myslice_platforms: + myslice_platform, = myslice_platforms + platform_ids.append(myslice_platform['platform_id']) # We can check on which the user has authoritity credentials = PI rights credential_authorities = set() @@ -313,7 +320,7 @@ class ValidatePendingView(TemplateView): # ** Where am I a PI ** # For this we need to ask SFA (of all authorities) = PI function - pi_authorities_query = Query.get('ple:user').filter_by('user_hrn', '==', '$user_hrn').select('pi_authorities') + pi_authorities_query = Query.get('user').filter_by('user_hrn', '==', '$user_hrn').select('pi_authorities') pi_authorities_tmp = execute_query(self.request, pi_authorities_query) pi_authorities = set() for pa in pi_authorities_tmp: @@ -386,7 +393,7 @@ class ValidatePendingView(TemplateView): # more general variables expected in the template context['title'] = 'Test view that combines various plugins' # the menu items on the top - context['topmenu_items'] = topmenu_items('Validation', self.request) + context['topmenu_items'] = topmenu_items_live('Validation', page) # so we can sho who is logged context['username'] = the_user(self.request)