From bbc146e5dcbd1a5285b7465cd3e7f2c23a6dc9c8 Mon Sep 17 00:00:00 2001
From: Yasin <mohammed-yasin.rahman@lip6.fr>
Date: Fri, 31 Jan 2014 14:41:11 +0100
Subject: [PATCH] MyAcc: interface visibility depends on user_status

---
 portal/accountview.py              | 7 ++++---
 portal/templates/account-view.html | 3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/portal/accountview.py b/portal/accountview.py
index c06f578a..f366555d 100644
--- a/portal/accountview.py
+++ b/portal/accountview.py
@@ -185,6 +185,7 @@ class AccountView(LoginRequiredAutoLogoutView):
         context['my_users'] = my_users
         context['my_slices'] = my_slices
         context['my_auths'] = my_auths
+        context['user_status'] = user_status
         context['person']   = self.request.user
         context['firstname'] = config.get('firstname',"?")
         context['lastname'] = config.get('lastname',"?")
@@ -337,9 +338,9 @@ def account_process(request):
                         user_params = { 'config': keypair, 'auth_type':'managed'}
                         manifold_update_account(request,user_params)
                         # updating sfa
-                        public_key = public_key.replace('"', '');
-                        user_pub_key = {'keys': public_key}
-                        sfa_update_user(request, user_hrn, user_pub_key)
+                        #public_key = public_key.replace('"', '');
+                        #user_pub_key = {'keys': public_key}
+                        #sfa_update_user(request, user_hrn, user_pub_key)
                         messages.success(request, 'Sucess: New Keypair Generated! Delegation of your credentials will be automatic.')
                         return HttpResponseRedirect("/portal/account/")
         else:
diff --git a/portal/templates/account-view.html b/portal/templates/account-view.html
index 8f853e1b..74a2a0fd 100644
--- a/portal/templates/account-view.html
+++ b/portal/templates/account-view.html
@@ -175,7 +175,7 @@
 
 
 
-
+{%if 'Enabled'  in user_status %}
 <h3 id="show-pending" class="plugin-show" style="display: block;">
 <span class="glyphicon glyphicon-chevron-right"></span>
 <a href="#" class="plugin-tooltip" data-toggle="tooltip" data-original-title="Show plugin &quot;Pending operations&quot; (QueryUpdater)"></a>Credentials</h3>
@@ -322,6 +322,7 @@
     </div>
 </div>
 </div>
+{%endif%} 
 
 </form>
 
-- 
2.47.0