Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into fibre
authorLoic Baron <loic.baron@lip6.fr>
Thu, 24 Jul 2014 18:31:50 +0000 (15:31 -0300)
committerLoic Baron <loic.baron@lip6.fr>
Thu, 24 Jul 2014 18:31:50 +0000 (15:31 -0300)
Conflicts:
portal/registrationview.py

manifoldapi/static/css/manifold.css
manifoldapi/static/js/plugin.js
plugins/testbeds/templates/testbeds.html
portal/accountview.py
portal/actions.py
portal/joinview.py
portal/registrationview.py
portal/slicerequestview.py
portal/static/css/onelab.css
portal/templates/base.html

index 42c034d..535950e 100644 (file)
@@ -2,3 +2,18 @@
        visibility: hidden;
        position: absolute;
 }
+
+.loading {
+    background-color:white;
+    color:black;
+    position:fixed;
+    top:160px;
+    left:50%;
+    width:30%;
+    margin: 0 0 0 -15%;
+    padding:25px 50px;
+    box-shadow: 4px 4px 5px #888;
+    border:1pt solid #30196D;
+    display:none;
+    z-index:100;
+}
index 76e1cb5..324c8c4 100644 (file)
@@ -316,15 +316,18 @@ var Plugin = Class.extend({
     // use spin() to get our default spin settings (called presets)
     // use spin(true) to get spin's builtin defaults
     // you can also call spin_presets() yourself and tweak what you need to, like topmenuvalidation does
-    spin: function (presets) {
-       var presets = ( presets === undefined ) ? spin_presets() : presets;
-       try { this.$element.spin(presets); }
-       catch (err) { messages.debug("Cannot turn on spin " + err); }
+    spin: function (message) {
+       if (!message) {
+               message = 'Please be patient, this can take a few seconds.';
+       }
+       $('div.loading').fadeIn('fast');
+       $('div.loading').find('.message').text(message);
+
     },
 
     unspin: function() {
-       try { this.$element.spin(false); }
-       catch (err) { messages.debug("Cannot turn off spin " + err); }
+       $('div.loading').fadeOut('fast');
+
     },
 
     /* TEMPLATE */
index d670c9d..22f7f0a 100644 (file)
        </a>
 </div>
 
+<style>
+a.sl-platform  {
+    text-transform: uppercase;
+}
+
+</style>
+
 </div>
index c179a0e..fb9f642 100644 (file)
@@ -348,6 +348,8 @@ def account_process(request):
         return HttpResponseRedirect("/portal/account/")
 
 # XXX TODO: Factorize with portal/registrationview.py
+# XXX TODO: Factorize with portal/registrationview.py
+# XXX TODO: Factorize with portal/joinview.py
 
     elif 'generate' in request.POST:
         for account_detail in account_details:
index 0e77e59..b399ca2 100644 (file)
@@ -325,13 +325,14 @@ def portal_validate_request(wsgi_request, request_ids):
                 # XXX tmp sfa dependency
                 from sfa.util.xrn import Xrn 
                 urn = Xrn(hrn, request['type']).get_urn()
-
+                
+                # Only hrn is required for Manifold Query 
                 sfa_authority_params = {
-                    'hrn'        : hrn,
-                    'urn'        : urn,
-                    'type'       : request['type'],
+                    'authority_hrn'        : hrn,
+                    #'authority_urn'        : urn,
+                    #'type'       : request['type'],
                     #'pi'        : None,
-                    'enabled'    : True
+                    #'enabled'    : True
                 }
                 print "ADD Authority"
                 sfa_add_authority(wsgi_request, sfa_authority_params)
@@ -380,6 +381,8 @@ def create_slice(wsgi_request, request):
     # Add User to Slice if we have the user_hrn in pendingslice table
     user_hrn = request.get('user_hrn', None)
     user_hrns = list([user_hrn]) if user_hrn else list()
+    
+    user_email = request.get
 
     # XXX We should create a slice with Manifold terminology
     slice_params = {
@@ -395,6 +398,13 @@ def create_slice(wsgi_request, request):
     results = execute_query(wsgi_request, query)
     if not results:
         raise Exception, "Could not create %s. Already exists ?" % slice_params['hrn']
+    ## We do not store the email in pendingslice table. As a result receiver's email is unknown ##
+    ## Need modification in pendingslice table ###
+    #else:
+    #    subject = 'Slice created'
+    #    msg = 'A manager of your institution has validated your slice request. You can now add resources to the slice and start experimenting.'
+    #    send_mail(subject, msg, 'support@onelab.eu',['yasin.upmc@gmail.com'], fail_silently=False)
+       
     return results
 
 def create_pending_slice(wsgi_request, request, email):
@@ -509,6 +519,10 @@ def sfa_create_user(wsgi_request, request):
     results = execute_query(wsgi_request, query)
     if not results:
         raise Exception, "Could not create %s. Already exists ?" % sfa_user_params['user_hrn']
+    else:
+        subject = 'User validated'
+        msg = 'A manager of your institution has validated your account. You have now full user access to the portal.'
+        send_mail(subject, msg, 'support@onelab.eu',[request['email']], fail_silently=False)       
     return results
 
 def ldap_create_user(wsgi_request, request, user_detail):
index 8356dec..f9eed28 100644 (file)
@@ -74,6 +74,8 @@ class JoinView (FreeAccessView, ThemeView):
             #prepare user_hrn 
             split_email = reg_email.split("@")[0] 
             split_email = split_email.replace(".", "_")
+            # Replace + by _ => more convenient for testing and validate with a real email
+            split_email = split_email.replace("+", "_")
             user_hrn = reg_auth + '.' + split_email
             
             UserModel = get_user_model()
@@ -108,18 +110,15 @@ class JoinView (FreeAccessView, ThemeView):
                     errors.append('Email already registered in Manifold. Please provide a new email address.')
 
 # XXX TODO: Factorize with portal/accountview.py
+# XXX TODO: Factorize with portal/registrationview.py
+# XXX TODO: Factorize with portal/joinview.py
 #            if 'generate' in request.POST['question']:
             from Crypto.PublicKey import RSA
             private = RSA.generate(1024)
-            private_key = json.dumps(private.exportKey())
-            public  = private.publickey()
-            public_key = json.dumps(public.exportKey(format='OpenSSH'))
-
+            private_key = private.exportKey()
+            public_key = private.publickey().exportKey(format='OpenSSH')
             # Saving to DB
-            account_config = '{"user_public_key":'+ public_key + ', "user_private_key":'+ private_key + ', "user_hrn":"'+ user_hrn + '"}'
             auth_type = 'managed'
-            public_key = public_key.replace('"', '');
-            private_key = private_key.replace('"', '');
 
             if not errors:
                 reg_password = request.POST['pi_password']
index c6dbd2a..909f2a1 100644 (file)
@@ -95,6 +95,9 @@ class RegistrationView (FreeAccessView, ThemeView):
             
             split_email = user_request['email'].split("@")[0] 
             split_email = split_email.replace(".", "_")
+            # Replace + by _ => more convenient for testing and validate with a real email
+            split_email = split_email.replace("+", "_")
+
             split_authority = user_request['authority_hrn'].split(".")[1]
             username = split_email + '@' + split_authority
             split_authority = user_request['authority_hrn'].split(".")[0]
@@ -132,6 +135,8 @@ class RegistrationView (FreeAccessView, ThemeView):
                             + '.' + split_email + str(randint(1,1000000))
                 
             # XXX TODO: Factorize with portal/accountview.py
+            # XXX TODO: Factorize with portal/registrationview.py
+            # XXX TODO: Factorize with portal/joinview.py
             if 'generate' in wsgi_request.POST['question']:
                 user_request['auth_type'] = 'managed'
 
index e81602a..a94f650 100644 (file)
@@ -35,6 +35,7 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
         purpose=''
         exp_url=''
         authority_hrn = None
+        authority_name = None
         # Retrieve the list of authorities
         authorities_query = Query.get('authority').select('name', 'authority_hrn')
         authorities = execute_admin_query(wsgi_request, authorities_query)
@@ -54,6 +55,9 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
             if authority['authority_hrn'] == user_authority:
                 authority_name = authority['name']
 
+        # Handle the case when we use only hrn and not name
+        if authority_name is None:
+            authority_name = user_authority
         #
         account_query  = Query().get('local:account').select('user_id','platform_id','auth_type','config')
         account_details = execute_query(wsgi_request, account_query)
@@ -98,7 +102,7 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
                 if authority['name'] == wsgi_request.POST.get('org_name', ''):
                     authority_hrn = authority['authority_hrn']
 
-            # Handle the case when the template uses only hrn and not name
+            # Handle the case when we use only hrn and not name
             if authority_hrn is None:
                 authority_hrn = wsgi_request.POST.get('org_name', '')
 
index 4c53cce..5be1bf3 100644 (file)
@@ -12,6 +12,7 @@ body {
 a, a:active, a:focus {
     outline: 0;
     text-decoration:none;
+    color:#201E62;
 }
 
 h1 {
@@ -26,13 +27,20 @@ h1 img {
     margin-right:10px;
 }
 h2 {
+    margin:0 0 15px 0;
     font-size:14pt;
     color:#333333;
 }
 h3 {
+    margin:0 0 5px 0;
     font-size:13pt;
     color:#201E62;
 }
+h4 {
+    margin:0 0 5px 0;
+    font-size:12pt;
+    color:#333333;
+}
 input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number], select, option {
     min-width:260px;
     padding:6px;
@@ -61,6 +69,9 @@ div.breadcrumbs {
     color:gray;
     font-size:10pt;
 }
+.tab-pane {
+    padding-top:15px;
+}
 /* buttons */
 button.btn, input.btn {
     padding:6px 10px;
index b282727..750b427 100644 (file)
@@ -92,5 +92,14 @@ $(document).ready(function() {
        {% block base_content %}
        {% endblock %}
 {% endblock container %}
+<div class="loading">
+       <div class="row">
+               <div class="col-xs-11">Loading...</div>
+               <div class="col-xs-1"><img src="{{ STATIC_URL }}/img/loading.gif" /></div>
+       </div>
+       <div class="row">
+               <div class="col-xs-12 message"></div>
+       </div>
+</div>
 </body>
 </html>