From: Yasin Date: Fri, 25 Jul 2014 16:31:20 +0000 (+0200) Subject: Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab X-Git-Tag: myslice-1.0~38 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=75fb889a57311c7755c2a326c4f3206c07f8cff5;hp=b9ad9634e8d318e491371b13284e025a35307d9a;p=myslice.git Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab --- diff --git a/myslice/urls.py b/myslice/urls.py index a4dcf96a..e8452593 100644 --- a/myslice/urls.py +++ b/myslice/urls.py @@ -80,10 +80,10 @@ urls = [ (r'^update/(?P[^/]+)/(?P[^/]+)?/?$', 'rest.update.dispatch'), (r'^create/(?P[^/]+)/(?P[^/]+)?/?$', 'rest.create.dispatch'), (r'^delete/(?P[^/]+)/(?P[^/]+)?/?$', 'rest.delete.dispatch'), - (r'^credentials/(?P[^/]+)/(?P[^/]+)?/?$', 'rest.credentials.dispatch'), + (r'^credentials/(?P[^/]+)/?$', 'rest.credentials.dispatch'), # # REST monitoring - (r'^monitor/sfa/getversion/?$', 'rest.monitor.sfaGetVersion'), + #(r'^monitor/sfa/getversion/?$', 'rest.monitor.sfaGetVersion'), # #(r'^view/?', include('view.urls')), #(r'^list/slices', 'view.list.slices') diff --git a/rest/credentials.py b/rest/credentials.py index fa1f9b83..d63babfb 100644 --- a/rest/credentials.py +++ b/rest/credentials.py @@ -2,16 +2,20 @@ from django.http import HttpResponse from portal.actions import clear_user_creds import json -def dispatch(request, action, object): +def dispatch(request, action): if (action == 'clear') : - try : - res = clear_user_creds(request, object) - except : - pass + res=[] + emails = request.POST.getlist('emails[]') + if emails : + for email in emails : + try : + res.append(clear_user_creds(request, email)) + except : + pass - if res is not None : - ret = { "ret" : 1, "email" : res } + if not res : + ret = { "ret" : 1, "emails" : res } else : ret = { "ret" : 0 }