From: Yasin Date: Mon, 17 Feb 2014 15:38:39 +0000 (+0100) Subject: ManageUser: email edit disabled [will be too complicated(user_hrn??).]. Authority... X-Git-Tag: myslice-1.1~331^2~8 X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=commitdiff_plain;h=d25b15bb54f4d6b26664d7c2554f632d767e461b ManageUser: email edit disabled [will be too complicated(user_hrn??).]. Authority edit enabled --- diff --git a/portal/manageuserview.py b/portal/manageuserview.py index 11166bbe..3f3ebde6 100644 --- a/portal/manageuserview.py +++ b/portal/manageuserview.py @@ -321,17 +321,27 @@ def user_process(request, **kwargs): messages.success(request, 'Sucess: First Name and Last Name Updated.') return HttpResponseRedirect(redirect_url) - #elif 'submit_pass' in request.POST: - # edited_password = request.POST['password'] - # - # for user_pass in user_details: - # user_pass['password'] = edited_password - # #updating password in local:user - # user_params = { 'password': user_pass['password']} - # manifold_update_user(request,request.user.email,user_params) -# # return HttpResponse('Success: Password Changed!!') - # messages.success(request, 'Sucess: Password Updated.') - # return HttpResponseRedirect("/portal/account/") + elif 'submit_auth' in request.POST: + edited_auth = request.POST['authority'] + + config={} + for user_config in user_details: + if user_config['config']: + config = json.loads(user_config['config']) + config['firstname'] = config.get('firstname', 'N/A') + config['lastname'] = config.get('lastname','N/A') + config['authority'] = edited_auth + updated_config = json.dumps(config) + user_params = {'config': updated_config} + else: # it's needed if the config is empty + user_config['config']= '{"firstname": "N/A", "lastname":"N/A", "authority":"' + edited_auth + '"}' + user_params = {'config': user_config['config']} + # updating config local:user in manifold + manifold_update_user(request, user_email, user_params) + # this will be depricated, we will show the success msg in same page + # Redirect to same page with success message + messages.success(request, 'Sucess: Authority Updated.') + return HttpResponseRedirect(redirect_url) # XXX TODO: Factorize with portal/registrationview.py diff --git a/portal/templates/manageuserview.html b/portal/templates/manageuserview.html index 9b45708e..3675c9af 100644 --- a/portal/templates/manageuserview.html +++ b/portal/templates/manageuserview.html @@ -22,22 +22,11 @@
Platform: Myslice
- + Email - - {{ user_email }} - - -
- - -
- - - - + {{ user_email }} + + Full Name {{ fullname }} @@ -53,7 +42,7 @@ - + Authority {{ authority }} @@ -68,7 +57,7 @@ - + Generate Keys - + Public Key ******** @@ -97,7 +86,7 @@ - + {%if 'N/A' not in user_private_key%} Private Key ********