Merge branch 'master' of ssh://git.onelab.eu/git/myslice
authorCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Thu, 20 Feb 2014 16:09:48 +0000 (17:09 +0100)
committerCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Thu, 20 Feb 2014 16:09:48 +0000 (17:09 +0100)
Conflicts:
portal/slicerequestview.py
portal/usersview.py

portal/accountview.py
portal/actions.py
portal/manageuserview.py
portal/slicerequestview.py
portal/static/js/my_account.edit_profile.js
portal/templates/manageuserview.html
portal/templates/usersview.html [moved from portal/templates/adminview.html with 100% similarity]
portal/urls.py
portal/usersview.py [moved from portal/adminview.py with 93% similarity]

index d4499a8..ce504ac 100644 (file)
@@ -239,7 +239,7 @@ def account_process(request):
             if 'delete_'+platform_detail['platform'] in request.POST:
                 platform_id = platform_detail['platform_id']
                 user_params = {'user_id':user_id}
-                manifold_delete_account(request,platform_id,user_params)
+                manifold_delete_account(request,platform_id, user_id, user_params)
                 messages.info(request, 'Reference Account is removed from the selected platform')
                 return HttpResponseRedirect("/portal/account/")
 
@@ -339,7 +339,7 @@ def account_process(request):
                         updated_config = json.dumps(account_config) 
                         # updating manifold
                         user_params = { 'config': keypair, 'auth_type':'managed'}
-                        manifold_update_account(request,user_params)
+                        manifold_update_account(request, user_id, user_params)
                         # updating sfa
                         public_key = public_key.replace('"', '');
                         user_pub_key = {'keys': public_key}
@@ -370,7 +370,7 @@ def account_process(request):
                             file_content = ''.join(file_content.split())
                             #update manifold local:account table
                             user_params = { 'config': file_content, 'auth_type':'user'}
-                            manifold_update_account(request,user_params)
+                            manifold_update_account(request, user_id, user_params)
                             # updating sfa
                             user_pub_key = {'keys': file_content}
                             sfa_update_user(request, user_hrn, user_pub_key)
@@ -430,7 +430,7 @@ def account_process(request):
                                 
                             updated_config = json.dumps(account_config)
                             user_params = { 'config': updated_config, 'auth_type':'user'}
-                            manifold_update_account(request,user_params)
+                            manifold_update_account(request, user_id, user_params)
                             messages.success(request, 'Private Key deleted. You need to delegate credentials manually once it expires.')
                             messages.success(request, 'Once your credentials expire, Please delegate manually using SFA: http://trac.myslice.info/wiki/DelegatingCredentials')
                             return HttpResponseRedirect("/portal/account/")
@@ -456,7 +456,7 @@ def account_process(request):
                             user_priv_key = json.dumps(account_config.get('user_private_key','N/A'))
                             updated_config = '{"user_public_key":'+ user_pub_key + ', "user_private_key":'+ user_priv_key + ', "user_hrn":"'+ user_hrn + '"}'
                             user_params = { 'config': updated_config}
-                            manifold_update_account(request,user_params)
+                            manifold_update_account(request,user_id, user_params)
                             messages.success(request, 'All Credentials cleared')
                             return HttpResponseRedirect("/portal/account/")
                         else:
index 3ee568c..1211705 100644 (file)
@@ -110,21 +110,16 @@ def manifold_add_account(request, account_params):
     result, = results
     return result['user_id']
 
-def manifold_update_account(request,account_params):
+def manifold_update_account(request,user_id,account_params):
     # account_params: config
-    query = Query.update('local:account').filter_by('platform', '==', 'myslice').set(account_params).select('user_id')
-    results = execute_query(request,query)
-    # NOTE: results remains empty and goes to Exception. However, it updates the manifold DB.
-    # That's why I commented the exception part. -- Yasin 
-    #if not results:
-    #    raise Exception, "Failed updating manifold account: config %s" % account_params['config']
-    #result, = results
+    query = Query.update('local:account').filter_by('platform', '==', 'myslice').filter_by('user_id', '==', user_id).set(account_params).select('user_id')
+    results = execute_admin_query(request,query)
     return results
 
 #explicitly mention the platform_id
-def manifold_delete_account(request, platform_id, account_params):
-    query = Query.delete('local:account').filter_by('platform_id', '==', platform_id).set(account_params).select('user_id')
-    results = execute_query(request,query)
+def manifold_delete_account(request, platform_id, user_id, account_params):
+    query = Query.delete('local:account').filter_by('platform_id', '==', platform_id).filter_by('user_id', '==', user_id).set(account_params).select('user_id')
+    results = execute_admin_query(request,query)
     return results
 
 
index cbed7ab..f036f04 100644 (file)
@@ -41,8 +41,6 @@ class UserView(LoginRequiredAutoLogoutView, ThemeView):
         for user_detail in user_details:
             user_id = user_detail['user_id']
             user_email = user_detail['email'] 
-            print "hello_world"
-            print user_id          
             # different significations of user_status
             if user_detail['status'] == 0: 
                 user_status = 'Disabled'
@@ -217,19 +215,28 @@ class UserView(LoginRequiredAutoLogoutView, ThemeView):
 
 @login_required
 #my_acc form value processing
-def user_process(request):
-    user_query  = Query().get('local:user').select('user_id','email','password','config')
-    user_details = execute_query(request, user_query)
-    
-    account_query  = Query().get('local:account').select('user_id','platform_id','auth_type','config')
-    account_details = execute_query(request, account_query)
+def user_process(request, **kwargs):
+        
+    for key, value in kwargs.iteritems():
+        if key == "email":
+            selected_email=value
 
-    platform_query  = Query().get('local:platform').select('platform_id','platform')
-    platform_details = execute_query(request, platform_query)
+    redirect_url = "/portal/user/"+selected_email
     
+    user_query  = Query().get('local:user').filter_by('email', '==', selected_email).select('user_id','email','password','config')
+    user_details = execute_admin_query(request, user_query)
+
     # getting the user_id from the session
     for user_detail in user_details:
-            user_id = user_detail['user_id']
+        user_id = user_detail['user_id']
+        user_email = user_detail['email']
+
+    account_query  = Query().get('local:account').filter_by('user_id', '==', user_id).select('user_id','platform_id','auth_type','config')
+    account_details = execute_admin_query(request, account_query)
+
+    platform_query  = Query().get('local:platform').select('platform_id','platform')
+    platform_details = execute_admin_query(request, platform_query)
+    
 
     for account_detail in account_details:
         for platform_detail in platform_details:
@@ -237,17 +244,17 @@ def user_process(request):
             if 'add_'+platform_detail['platform'] in request.POST:
                 platform_id = platform_detail['platform_id']
                 user_params = {'platform_id': platform_id, 'user_id': user_id, 'auth_type': "reference", 'config': '{"reference_platform": "myslice"}'}
-                manifold_add_account(request,user_params)
+                manifold_add_account(request, user_params)
                 messages.info(request, 'Reference Account is added to the selected platform successfully!')
-                return HttpResponseRedirect("/portal/account/")
+                return HttpResponseRedirect(redirect_url)
 
             # Delete reference account from the platforms
             if 'delete_'+platform_detail['platform'] in request.POST:
                 platform_id = platform_detail['platform_id']
                 user_params = {'user_id':user_id}
-                manifold_delete_account(request,platform_id,user_params)
-                messages.info(request, 'Reference Account is removed from the selected platform')
-                return HttpResponseRedirect("/portal/account/")
+                manifold_delete_account(request, platform_id, user_id, user_params)
+                messages.info(request, 'Refeence Account is removed from the selected platform')
+                return HttpResponseRedirect(redirect_url)
 
             if platform_detail['platform_id'] == account_detail['platform_id']:
                 if 'myslice' in platform_detail['platform']:
@@ -307,23 +314,33 @@ def user_process(request):
                 user_config['config']= '{"firstname":"' + edited_first_name + '", "lastname":"'+ edited_last_name + '", "authority": "Unknown Authority"}'
                 user_params = {'config': user_config['config']} 
         # updating config local:user in manifold       
-        manifold_update_user(request, request.user.email,user_params)
+        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: First Name and Last Name Updated.')
-        return HttpResponseRedirect("/portal/account/")       
+        return HttpResponseRedirect(redirect_url)       
     
-    elif 'submit_pass' in request.POST:
-        edited_password = request.POST['password']
+    elif 'submit_auth' in request.POST:
+        edited_auth = request.POST['authority']
         
-        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/")
+        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
 
@@ -345,16 +362,16 @@ def user_process(request):
                         updated_config = json.dumps(account_config) 
                         # updating manifold
                         user_params = { 'config': keypair, 'auth_type':'managed'}
-                        manifold_update_account(request,user_params)
+                        manifold_update_account(request, user_id, 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/")
+                        return HttpResponseRedirect(redirect_url)
         else:
             messages.error(request, 'Account error: You need an account in myslice platform to perform this action')
-            return HttpResponseRedirect("/portal/account/")
+            return HttpResponseRedirect(redirect_url)
                        
     elif 'upload_key' in request.POST:
         for account_detail in account_details:
@@ -376,15 +393,15 @@ def user_process(request):
                             file_content = ''.join(file_content.split())
                             #update manifold local:account table
                             user_params = { 'config': file_content, 'auth_type':'user'}
-                            manifold_update_account(request,user_params)
+                            manifold_update_account(request,user_id,user_params)
                             # updating sfa
-                            user_pub_key = {'keys': file_content}
-                            sfa_update_user(request, user_hrn, user_pub_key)
+                            #user_pub_key = {'keys': file_content}
+                            #sfa_update_user(request, user_hrn, user_pub_key)
                             messages.success(request, 'Publickey uploaded! Please delegate your credentials using SFA: http://trac.myslice.info/wiki/DelegatingCredentials')
-                            return HttpResponseRedirect("/portal/account/")
+                            return HttpResponseRedirect(redirect_url)
                         else:
                             messages.error(request, 'RSA key error: Please upload a valid RSA public key [.txt or .pub].')
-                            return HttpResponseRedirect("/portal/account/")
+                            return HttpResponseRedirect(redirect_url)
         else:
             messages.error(request, 'Account error: You need an account in myslice platform to perform this action')
             return HttpResponseRedirect("/portal/account/")
@@ -402,7 +419,7 @@ def user_process(request):
                         break
         else:
             messages.error(request, 'Account error: You need an account in myslice platform to perform this action')
-            return HttpResponseRedirect("/portal/account/")
+            return HttpResponseRedirect(redirect_url)
                
     elif 'dl_pkey' in request.POST:
         for account_detail in account_details:
@@ -417,36 +434,36 @@ def user_process(request):
                             return response
                         else:
                             messages.error(request, 'Download error: Private key is not stored in the server')
-                            return HttpResponseRedirect("/portal/account/")
+                            return HttpResponseRedirect(redirect_url)
 
         else:
             messages.error(request, 'Account error: You need an account in myslice platform to perform this action')
             return HttpResponseRedirect("/portal/account/")
     
-    elif 'delete' in request.POST:
-        for account_detail in account_details:
-            for platform_detail in platform_details:
-                if platform_detail['platform_id'] == account_detail['platform_id']:
-                    if 'myslice' in platform_detail['platform']:
-                        account_config = json.loads(account_detail['config'])
-                        if 'user_private_key' in account_config:
-                            for key in account_config.keys():
-                                if key == 'user_private_key':    
-                                    del account_config[key]
-                                
-                            updated_config = json.dumps(account_config)
-                            user_params = { 'config': updated_config, 'auth_type':'user'}
-                            manifold_update_account(request,user_params)
-                            messages.success(request, 'Private Key deleted. You need to delegate credentials manually once it expires.')
-                            messages.success(request, 'Once your credentials expire, Please delegate manually using SFA: http://trac.myslice.info/wiki/DelegatingCredentials')
-                            return HttpResponseRedirect("/portal/account/")
-                        else:
-                            messages.error(request, 'Delete error: Private key is not stored in the server')
-                            return HttpResponseRedirect("/portal/account/")
-                           
-        else:
-            messages.error(request, 'Account error: You need an account in myslice platform to perform this action')    
-            return HttpResponseRedirect("/portal/account/")
+#    elif 'delete' in request.POST:
+#        for account_detail in account_details:
+#            for platform_detail in platform_details:
+#                if platform_detail['platform_id'] == account_detail['platform_id']:
+#                    if 'myslice' in platform_detail['platform']:
+#                        account_config = json.loads(account_detail['config'])
+#                        if 'user_private_key' in account_config:
+#                            for key in account_config.keys():
+#                                if key == 'user_private_key':    
+#                                    del account_config[key]
+#                                
+#                            updated_config = json.dumps(account_config)
+#                            user_params = { 'config': updated_config, 'auth_type':'user'}
+#                            manifold_update_account(request,user_params)
+#                            messages.success(request, 'Private Key deleted. You need to delegate credentials manually once it expires.')
+#                            messages.success(request, 'Once your credentials expire, Please delegate manually using SFA: http://trac.myslice.info/wiki/DelegatingCredentials')
+#                            return HttpResponseRedirect("/portal/account/")
+#                        else:
+#                            messages.error(request, 'Delete error: Private key is not stored in the server')
+#                            return HttpResponseRedirect(redirect_url)
+#                           
+#        else:
+#            messages.error(request, 'Account error: You need an account in myslice platform to perform this action')    
+#            return HttpResponseRedirect(redirect_url)
 
     #clear all creds
     elif 'clear_cred' in request.POST:
@@ -462,15 +479,15 @@ def user_process(request):
                             user_priv_key = json.dumps(account_config.get('user_private_key','N/A'))
                             updated_config = '{"user_public_key":'+ user_pub_key + ', "user_private_key":'+ user_priv_key + ', "user_hrn":"'+ user_hrn + '"}'
                             user_params = { 'config': updated_config}
-                            manifold_update_account(request,user_params)
+                            manifold_update_account(request, user_id,user_params)
                             messages.success(request, 'All Credentials cleared')
                             return HttpResponseRedirect("/portal/account/")
                         else:
                             messages.error(request, 'Delete error: Credentials are not stored in the server')
-                            return HttpResponseRedirect("/portal/account/")
+                            return HttpResponseRedirect(redirect_url)
         else:
             messages.error(request, 'Account error: You need an account in myslice platform to perform this action')
-            return HttpResponseRedirect("/portal/account/")
+            return HttpResponseRedirect(redirect_url)
 
 
     # Download delegated_user_cred
@@ -482,10 +499,10 @@ def user_process(request):
             return response
         else:
             messages.error(request, 'Download error: User credential  is not stored in the server')
-            return HttpResponseRedirect("/portal/account/")
+            return HttpResponseRedirect(redirect_url)
         
     else:
         messages.info(request, 'Under Construction. Please try again later!')
-        return HttpResponseRedirect("/portal/account/")
+        return HttpResponseRedirect(redirect_url)
 
 
index 9d7a970..cf818dc 100644 (file)
@@ -12,7 +12,9 @@ from portal.actions              import authority_get_pi_emails
 from portal.forms                import SliceRequestForm
 from unfold.loginrequired        import LoginRequiredAutoLogoutView
 from ui.topmenu                  import topmenu_items_live, the_user
-from theme import ThemeView
+
+import json
+
 class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
     def __init__ (self):
         self.user_email = ''
@@ -37,10 +39,29 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
         user_email = execute_query(self.request, user_query)
         self.user_email = user_email[0].get('email')
 
-        user_query  = Query().get('user').select('user_hrn').filter_by('user_hrn','==','$user_hrn')
-        user_hrn = execute_query(self.request, user_query)
-        self.user_hrn = user_hrn[0].get('user_hrn')
 
+        account_query  = Query().get('local:account').select('user_id','platform_id','auth_type','config')
+        account_details = execute_query(self.request, account_query)
+
+        platform_query  = Query().get('local:platform').select('platform_id','platform','gateway_type','disabled')
+        platform_details = execute_query(self.request, platform_query)
+
+        # getting user_hrn from local:account
+        for account_detail in account_details:
+            for platform_detail in platform_details:
+                if platform_detail['platform_id'] == account_detail['platform_id']:
+                    # taking user_hrn only from myslice account
+                    # NOTE: we should later handle accounts filter_by auth_type= managed OR user
+                    if 'myslice' in platform_detail['platform']:
+                        account_config = json.loads(account_detail['config'])
+                        user_hrn = account_config.get('user_hrn','N/A')
+
+
+        #user_query  = Query().get('user').select('user_hrn').filter_by('user_hrn','==','$user_hrn')
+        #user_hrn = execute_query(self.request, user_query)
+        #self.user_hrn = user_hrn[0].get('user_hrn')
+        
+        
         page = Page(request)
         page.add_css_files ( [ "http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" ] )
 
@@ -53,7 +74,7 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
             number_of_nodes = request.POST.get('number_of_nodes', '')
             purpose = request.POST.get('purpose', '')
             email = self.user_email
-            user_hrn = self.user_hrn
+            user_hrn = user_hrn
             cc_myself = True
             
             if (authority_hrn is None or authority_hrn == ''):
@@ -101,11 +122,10 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
           'number_of_nodes': request.POST.get('number_of_nodes', ''),
           'purpose': request.POST.get('purpose', ''),
           'email': self.user_email,
-          'user_hrn': self.user_hrn,
+          'user_hrn': user_hrn,
           'cc_myself': True,
           'authorities': authorities,
           'theme': self.theme
         }
         template_env.update(page.prelude_env ())
         return render(request, 'slicerequest_view.html',template_env)
-
index 70607ba..f98427e 100644 (file)
@@ -20,9 +20,9 @@ jQuery(document).ready(function(){
                               jQuery("#span_pass").hide();
                               jQuery("#edit_pass").show();
                               jQuery("#passval").show();
-                              jQuery("#span_aff").hide();
-                              jQuery("#edit_aff").show();
-                              jQuery("#affval").show();
+                              jQuery("#span_auth").hide();
+                              jQuery("#edit_auth").show();
+                              jQuery("#authval").show();
                               jQuery("#span_email").hide();
                               jQuery("#edit_email").show();
                               jQuery("#emailval").show();
@@ -49,9 +49,9 @@ jQuery(document).ready(function(){
                               jQuery("#span_name").hide();
                               jQuery("#edit_name").show();
                               jQuery("#nameval").show();
-                              jQuery("#span_aff").hide();
-                              jQuery("#edit_aff").show();
-                              jQuery("#affval").show();
+                              jQuery("#span_auth").hide();
+                              jQuery("#edit_aauth").show();
+                              jQuery("#authval").show();
                               jQuery("#span_email").hide();
                               jQuery("#edit_email").show();
                               jQuery("#emailval").show();
@@ -77,12 +77,12 @@ jQuery(document).ready(function(){
                                 }
                             }
                       });
-                      //edit affiliation
-                      jQuery("#edit_aff").click(function(){
+                      //edit authority
+                      jQuery("#edit_auth").click(function(){
 
-                              jQuery("#span_aff").show();
-                              jQuery("#affval").hide();
-                              jQuery("#edit_aff").hide();
+                              jQuery("#span_auth").show();
+                              jQuery("#authval").hide();
+                              jQuery("#edit_auth").hide();
                               // enforcing when one edit is clicked the rest will not work at same time
                               jQuery("#span_pass").hide();
                               jQuery("#edit_pass").show();
@@ -98,14 +98,14 @@ jQuery(document).ready(function(){
                               jQuery("#dl_file").show();
                               jQuery("#upload_file").show();
                       });
-                      jQuery("#cancel_aff_change").click(function(){
+                      jQuery("#cancel_auth_change").click(function(){
 
-                              jQuery("#span_aff").hide();
-                              jQuery("#affval").show();
-                              jQuery("#edit_aff").show();
+                              jQuery("#span_auth").hide();
+                              jQuery("#authval").show();
+                              jQuery("#edit_auth").show();
                       });
                       //edit email
-                      /edit email will be done by PI if needed
+                      //edit email will be done by PI if needed
                       jQuery("#edit_email").click(function(){
 
                               jQuery("#span_email").show();
@@ -115,9 +115,9 @@ jQuery(document).ready(function(){
                               jQuery("#span_pass").hide();
                               jQuery("#edit_pass").show();
                               jQuery("#passval").show();
-                              jQuery("#span_aff").hide();
-                              jQuery("#edit_aff").show();
-                              jQuery("#affval").show();
+                              jQuery("#span_auth").hide();
+                              jQuery("#edit_auth").show();
+                              jQuery("#authval").show();
                               jQuery("#span_name").hide();
                               jQuery("#edit_name").show();
                               jQuery("#nameval").show();
@@ -131,7 +131,7 @@ jQuery(document).ready(function(){
                               jQuery("#span_email").hide();
                               jQuery("#emailval").show();
                               jQuery("#edit_email").show();
-                      }); */
+                      }); 
                       //upload pub keys
                       jQuery("#upload_file").click(function(){
 
@@ -146,9 +146,9 @@ jQuery(document).ready(function(){
                               jQuery("#span_pass").hide();
                               jQuery("#edit_pass").show();
                               jQuery("#passval").show();
-                              jQuery("#span_aff").hide();
-                              jQuery("#edit_aff").show();
-                              jQuery("#affval").show();
+                              jQuery("#span_auth").hide();
+                              jQuery("#edit_auth").show();
+                              jQuery("#authval").show();
                               jQuery("#span_email").hide();
                               jQuery("#edit_email").show();
                               jQuery("#emailval").show();
index 24ca18c..a877dbf 100644 (file)
@@ -12,7 +12,7 @@
 {% endif %}
 
 
-<form id="editForm"  method="POST" action="account_process" enctype="multipart/form-data">
+<form id="editForm"  method="POST" action="{{user_email}}/user_process" enctype="multipart/form-data">
 <div id="middle" align="center">
        <div class="well">
                {% csrf_token %}
                                                <div id="info">Platform: Myslice</div>
                                </td>
                        </tr>
-                       <tr class="even">
-                               <td class="key">Email</td>
-                               <td class="value">
-                                               <span id="emailval" class="value" >{{ user_email }}</span>
-                                               <button class="btn btn-default btn-xs" type="button" id="edit_email"  title="To change your affiliation please contact the administrator">
-                                               <span class="glyphicon glyphicon-edit"></span> Edit
-                                               </button>
-                                       </td>
-                       </tr>
-                       <tr class="even">
+                               <tr class="even">
+                               <td class="key">Email</td>
+                               <td class="value"> <span id="emailval" class="value" >{{ user_email }}</span> </td>
+                               </tr>
+                       <tr class="odd">
                                        <td class="key">Full Name</td>
                                        <td class="value">
                                                <span id="nameval" class="value" >{{ fullname }} </span>
                                                </button>
                                        </td>
                        </tr>
-                       <tr class="odd">
-                                       <td class="key">Authority</td>
-                                       <td class="value">
-                                               <span id="affval" class="value">{{ authority }}</span>
-                                                <button class="btn btn-default btn-xs" type="button" id="edit_auth"   title="To change your authority please contact the administrator">
-                                               <span class="glyphicon glyphicon-edit"></span> Edit
-                                                </button>
-                                       </td>
-                               </tr>
                                <tr class="even">
+                               <td class="key">Authority</td>
+                               <td class="value">
+                                       <span id="authval" class="value" >{{ authority }} </span>
+                                       <span class="hide_this" id="span_auth">
+                                       <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_auth_change"> Cancel </button>
+                                       <div style='display:none;'><input type='hidden'  name='authform'  /></div>
+                                       <input id="authority" type="text" name="authority" class="required"  maxlength="200" value="{{authority}}" />
+                                       <input type="submit" class="btn btn-default btn-xs" name="submit_auth" value="Save"/>
+                                       </span>
+                                       <button class="btn btn-default btn-xs" type="button"title="auth" id="edit_auth">
+                                       <span class="glyphicon glyphicon-edit"></span> Edit
+                                       </button>
+                               </td>
+                               </tr>     
+                               <tr class="odd">
                                        <td class="key">Generate Keys</td>
                                        <td>
                                                <input type="submit" name="generate" class="btn btn-danger btn-xs" value="Generate a new Key Pair" id="generate_keypair" 
@@ -64,7 +65,7 @@
                                                           title="It will generate a new key Pair and your current credentials will be overwritten."/>
                                </td> 
                        </tr>
-                       <tr class="odd">
+                       <tr class="even">
                                <td class="key">Public Key</td>
                                <td class="value">
                                                <span id="keyval" class="value">******** </span>
                                                </button>       
                                </td>
                        </tr>
-                       <tr class="even" id="pkey_row">
-                                {%if 'N/A' not in user_private_key%}
-                               <td class="key">Private Key </td> <!-- Hide if priv_key doesn't exist in myslice platform   -->
-                               <td class="value">********<a href="#">
-                                       <button type="submit" name="dl_pkey" class="btn btn-default btn-xs" title="Download your privaye key" id="dl_pkey">
-                                                       <span class="glyphicon glyphicon-download"></span> Download     
-                                               </button>
-                                       <input class="btn btn-danger btn-xs" id="delete" name="delete" type="submit"  value="Delete" title="Delete your private key"
-                                                               onclick="return confirm('Are you sure? If you do so, you have to delegate your credentials manually.');"/> 
-                               </td>
-                                 {%else%}
-                                       <td class="key">Private Key </td> <!-- Hide if priv_key doesn't exist in myslice platform   -->
-                                       <td class="value">********<a href="#">
-                                       <button type="submit" name="dl_pkey" class="btn btn-default btn-xs disabled" title="Download your privaye key" id="dl_pkey">
-                                               <span class="glyphicon glyphicon-download"></span> Download 
-                                       </button>
-                                       <input class="btn btn-danger btn-xs disabled" id="delete" name="delete" type="submit" title="Delete your private key"
-                                                               value="Delete"  />
-                                       </td>
-                                {%endif%}              
-                               </tr>
                        </table>
        </div>
 </div>
index 98c7a79..87cf020 100644 (file)
 from django.views.generic.base   import TemplateView
 from django.conf.urls           import patterns, include, url
 
-from portal.adminview           import AdminView
+from portal.usersview           import UsersView
+from portal.manageuserview      import UserView, user_process    
 from portal.platformsview       import PlatformsView
 from portal.platformview        import PlatformView
 from portal.resourceview        import ResourceView
 from portal.dashboardview       import DashboardView
 from portal.accountview         import AccountView, account_process
-from portal.manageuserview      import UserView, user_process    
 from portal.contactview         import ContactView
 from portal.slicerequestview    import SliceRequestView
 from portal.registrationview    import RegistrationView
@@ -60,9 +60,9 @@ urlpatterns = patterns('',
     url(r'^dashboard/?$', DashboardView.as_view(), name='dashboard'),
     #url(r'^my_account/?$', MyAccountView.as_view(), name='my_account'),
     url(r'^account/?$', AccountView.as_view(), name='account'),
-    url(r'^admin/?$', AdminView.as_view(), name='user_list'),
-    url(r'^user/(?P<email>[\w\s.@\-]+)/?$', UserView.as_view(), name='account'),
-    url(r'^user/user_process/?$', user_process),
+    url(r'^users/?$', UsersView.as_view(), name='user_list'),
+    url(r'^user/(?P<email>[\w\s.@\-]+)/?$', UserView.as_view(), name='user'),
+    url(r'^user/(?P<email>[\w\s.@\-]+)/user_process/?$', user_process),
     url(r'^platforms/?$', PlatformsView.as_view(), name='platforms'),
     url(r'^platform/(?P<platformname>[\w\.\-]+)/?$', PlatformView.as_view(), name='platform'),
     url(r'^resource/(?P<urn>[\w\.\-\+\:]+)/?$', ResourceView.as_view(), name='resource'),
similarity index 93%
rename from portal/adminview.py
rename to portal/usersview.py
index 6560d9d..8d7f37e 100644 (file)
@@ -10,8 +10,8 @@ from theme import ThemeView
 import json
 
 # View for platforms
-class AdminView(LoginRequiredAutoLogoutView, ThemeView):
-    template_name = "adminview.html"
+class UsersView(LoginRequiredAutoLogoutView, ThemeView):
+    template_name = "usersview.html"
 
     def get_context_data(self, **kwargs):
         page = Page(self.request)
@@ -69,7 +69,7 @@ class AdminView(LoginRequiredAutoLogoutView, ThemeView):
         #        },
         #)
 
-        context = super(AdminView, self).get_context_data(**kwargs)
+        context = super(UsersView, self).get_context_data(**kwargs)
         context['person']   = self.request.user
         context['user_list'] = user_list
 
@@ -77,7 +77,7 @@ class AdminView(LoginRequiredAutoLogoutView, ThemeView):
         # more general variables expected in the template
         context['title'] = 'Users in MySlice'
         # the menu items on the top
-        context['topmenu_items'] = topmenu_items_live('Admin', page)
+        context['topmenu_items'] = topmenu_items_live('Users', page)
         # so we can sho who is logged
         context['username'] = the_user(self.request)
         context['theme'] = self.theme