#default_email = default_email.replace('\n', '')
#return default_email
# the above doesn't work
- return ['support@myslice.info']
+ return ['support@onelab.eu']
else:
pi_user_hrns = [ hrn for x in pi_users for hrn in x['pi_users'] ]
query = Query.get('user').filter_by('user_hrn', 'included', pi_user_hrns).select('user_email')
return results
+def iotlab_create_user (wsgi_request, request, namespace = None, as_admin=False):
+
+ import requests
+ import time
+ from requests.auth import HTTPBasicAuth
+
+ URL_REST = 'https://devgrenoble.senslab.info/rest/admin/users'
+ LOGIN_ADMIN = "auge"
+ PASSWORD_ADMIN = "k,mfg1+Q"
+
+ auth = HTTPBasicAuth(LOGIN_ADMIN,PASSWORD_ADMIN)
+ headers = {'content-type': 'application/json'}
+
+ for user in PendingUser.objects.raw('SELECT * FROM portal_pendinguser WHERE email = %s', [request['email']]):
+ password= user.password
+
+
+ iotlab_user_params = {
+ "type" : "SA",
+ "login" : request['email'],
+ "password" : password,
+ "firstName" : request['first_name'],
+ "lastName" : request['last_name'],
+ "email" : request['email'],
+ "structure" : request['authority_hrn'],
+ "city" : "N/A",
+ "country" : "N/A",
+ "sshPublicKey" : [request['public_key']],
+ "motivations" : "SFA federation",
+ }
+
+ iotlab_user_params1 = json.dumps(iotlab_user_params)
+ r=requests.post(url=URL_REST, data=iotlab_user_params1, headers=headers, auth=auth)
+ print 'Create iotlab user : ', r.status_code, r.text
+ return r.text
+
def create_user(wsgi_request, request, namespace = None, as_admin = False):
# XXX This has to be stored centrally
USER_STATUS_ENABLED = 2
# Add reference accounts for platforms
manifold_add_reference_user_accounts(wsgi_request, request)
+ # Add the user to iotlab portal if theme is set to onelab
+ if theme.theme == 'onelab':
+ iotlab_create_user (wsgi_request, request)
+
def create_pending_user(wsgi_request, request, user_detail):
"""
"""
theme.template_name = 'activate_user_email_subject.txt'
subject = render_to_string(theme.template, request)
subject = subject.replace('\n', '')
- #sender = 'support@myslice.info'
theme.template_name = 'email_default_sender.txt'
sender = render_to_string(theme.template, request)
sender = sender.replace('\n', '')
## we don't need it cz the new ticketing systems sends a confirmation email ###
#if cc_myself:
# recipients.append(email)
- #recipients = ['support@myslice.info']
theme.template_name = 'contact_support_email.html'
html_content = render_to_string(theme.template, form.cleaned_data)
activity.user.login(self.request)
## check user is pi or not
+ platform_details = {}
+ account_details = {}
+ acc_auth_cred = {}
+ acc_user_cred = {}
platform_query = Query().get('local:platform').select('platform_id','platform','gateway_type','disabled')
account_query = Query().get('local:account').select('user_id','platform_id','auth_type','config')
platform_details = execute_query(self.request, platform_query)
account_config = json.loads(account_detail['config'])
if 'myslice' in platform_detail['platform']:
acc_auth_cred = account_config.get('delegated_authority_credentials','N/A')
+ acc_user_cred = account_config.get('delegated_user_credential','N/A')
# assigning values
if acc_auth_cred=={} or acc_auth_cred=='N/A':
pi = "is_not_pi"
else:
pi = "is_pi"
- env['pi'] = pi
+ # check if the user has creds or not
+ if acc_user_cred == {} or acc_user_cred == 'N/A':
+ user_cred = 'no_creds'
+ else:
+ user_cred = 'has_creds'
+
+
+ env['pi'] = pi
+ env['user_cred'] = user_cred
else:
env['person'] = None
return render_to_response(self.template,env, context_instance=RequestContext(request))
env = self.default_env()
acc_auth_cred={}
if request.user.is_authenticated():
+
## check user is pi or not
+ platform_details = {}
+ account_details = {}
+ acc_auth_cred = {}
+ acc_user_cred = {}
platform_query = Query().get('local:platform').select('platform_id','platform','gateway_type','disabled')
account_query = Query().get('local:account').select('user_id','platform_id','auth_type','config')
# XXX Something like an invalid session seems to make the execute fail sometimes, and thus gives an error on the main page
account_config = json.loads(account_detail['config'])
if 'myslice' in platform_detail['platform']:
acc_auth_cred = account_config.get('delegated_authority_credentials','N/A')
+ acc_user_cred = account_config.get('delegated_user_credential','N/A')
# assigning values
if acc_auth_cred=={} or acc_auth_cred=='N/A':
pi = "is_not_pi"
else:
pi = "is_pi"
- env['pi'] = pi
+ # check if the user has creds or not
+ if acc_user_cred == {} or acc_user_cred == 'N/A':
+ user_cred = 'no_creds'
+ else:
+ user_cred = 'has_creds'
+
+
+ env['pi'] = pi
+ env['user_cred'] = user_cred
env['person'] = self.request.user
else:
env['person'] = None
--- /dev/null
+# this somehow is not used anymore - should it not be ?
+from django.core.context_processors import csrf
+from django.http import HttpResponseRedirect
+from django.contrib.auth import authenticate, login, logout
+from django.template import RequestContext
+from django.shortcuts import render_to_response
+from django.shortcuts import render
+
+from unfold.loginrequired import FreeAccessView
+
+from manifoldapi.manifoldresult import ManifoldResult
+from ui.topmenu import topmenu_items, the_user
+from myslice.configengine import ConfigEngine
+
+from myslice.theme import ThemeView
+
+class ManualDelegationView (FreeAccessView, ThemeView):
+ template_name = 'manual-delegation.html'
+
+ def get (self, request, state=None):
+
+ return render_to_response(self.template, { 'theme' : self.theme }, context_instance=RequestContext(request))
+
<p> More Info: <a href="http://myslice.info/" target="_blank">http://myslice.info/</a></p>
<p> Code: <a href="http://git.onelab.eu/?p=myslice.git;a=summary" target="_blank">Git Repository</a> (read only)</p>
<p>
- If you need write access to the git repository you need first to send your public key to <a href="mailto:support@myslice.info">support@myslice.info</a>.
+ If you need write access to the git repository you need first to send your public key to <a href="mailto:support@onelab.eu">support@onelab.eu</a>.
</p>
2. A manager from your organization validates your request. Upon confirmation of your signup request, we will send an email to the managers at your organization with a validation request.
We look forward to welcoming you to OneLab.
-Please don't hesitate to contact us at support@myslice.info with any additional questions that you might have.
+Please don't hesitate to contact us at support@onelab.eu with any additional questions that you might have.
<p>Please check our <a href="/portal/support/">FAQ</a> section. Most of the basic problems are explained there.</p>
<p>
If you haven't find your answes in the FAQ, please contact us by filling the form below.<br />
- You can also <a href="mailto:support@myslice.info">e-mail</a> us directly.
+ You can also <a href="mailto:support@onelab.eu">e-mail</a> us directly.
</p>
</div>
</div>
<p> More Info: <a href="http://myslice.info/" target="_blank">http://myslice.info/</a></p>
<p> Code: <a href="http://git.onelab.eu/?p=myslice.git;a=summary" target="_blank">Git Repository</a> (read only)</p>
<p>
- If you need write access to the git repository you need first to send your public key to <a href="mailto:support@myslice.info">support@myslice.info</a>.
+ If you need write access to the git repository you need first to send your public key to <a href="mailto:support@onelab.eu">support@onelab.eu</a>.
</p>
</div>
</div>
<div class="form-group" >
- <p></p>
+ <input type="checkbox" name="agreement" value="agreement" required /> I agree to the
+<a href="/terms" target="_blank">terms and conditions.</a>
+
+ <br><br>
<button type="submit" class="btn btn-onelab">Submit</button>
</div>
</form>
--- /dev/null
+{% extends "layout.html" %}
+
+{% block content %}
+
+<div class="col-md-8">
+ <br>
+ <h2>Manual Delegation</h2>
+ <h3>Install SFA</h3>
+
+ <p>
+ In order to delegate your credentials to the OneLab portal, you need to install SFA tools.<br>
+ </p>
+ <p>
+ <strong>[Requirement: python 2.7 or higher]</strong>
+ </p>
+ <h4>For Mac and Linux</h4>
+ <p class="command">
+ $ sudo easy_install pip<br>
+ $ sudo pip install sfa
+ </p>
+ <h4>For Windows</h4>
+ <p>Please download <a target="_blank" href="https://bootstrap.pypa.io/get-pip.py">get-pip.py</a></p>
+ <p class="command">
+ $ python get-pip.py<br>
+ $ pip install sfa
+ </p>
+
+ <p>
+ To get more information about pip, please visit: <a target="_blank" href="https://pip.pypa.io/en/latest/installing.html">https://pip.pypa.io/en/latest/installing.html</a>
+ </p>
+ <p>
+ More details about SFA is available at the following address:
+ <a target="_blank" href="http://svn.planet-lab.org/wiki/SFATutorialInstall#installingthroughpipfromPyPI">Installing SFA</a>
+ </p>
+
+ <h3>Configuring SFA</h3>
+
+ <p>
+ Once SFA tools are successfully installed, you need to configure the SFA client aka SFI
+ </p>
+ <p class="command">
+ $ mkdir ~/.sfi <br>
+ $ cd ~/.sfi <br>
+ $ cp ~/.ssh/id_rsa ~/.sfi/user-hrn.pkey
+ </p>
+
+ <p>
+ Here, 'user-hrn' is your SFA hrn. If e.g., your OneLab account email is mohammed-yasin.rahman at upmc.fr, then your user-hrn is <b><i>'onelab.upmc.mohammed-yasin_rahman'.</i></b></p>
+ <p>
+ In this example, a user-hrn is built using the root authority i.e, <b><i>'onelab'</i></b> followed by a <b>'.'</b> then the sub authority i.e., <b><i>'upmc'</i></b>
+ followed by a <b>'.'</b> and then the last fragment in the hrn is made of the local part of your email adress i.e., <b><i>'mohammed-yasin_rahman'</i></b>
+ (with dots replaced with underscores).
+ </p>
+
+ <p>
+ Next, you will setup your ~/.sfi/sfi_config. The following represents the sfi_config file for a OneLab user:
+ </p>
+
+ <p class="command">
+ [sfi]<br>
+ auth = onelab.upmc<br>
+ user = onelab.upmc.mohammed-yasin_rahman<br>
+ registry = http://portal.onelab.eu:12345/<br>
+ sm = http://sfa3.planet-lab.eu:12346/<br>
+ </p>
+
+ <p>
+ Here again, <b><i>'user'</i></b> is your user-hrn, and <b><i>'auth'</i></b> is the authority that you belong to, in most cases you should just drop the last part of your hrn.
+ </p>
+ <p>
+ Add the the following to sfi_config for delegating credentials to OneLab portal:
+ </p>
+ <p class="command">
+ [myslice]<br>
+ <br>
+ backend = http://portal.onelab.eu:7080<br>
+ delegate = onelab.myslice<br>
+ platform = myslice<br>
+ username = mohammed-yasin.rahman@lip6.fr
+ </p>
+ <p>
+ Test the SFA layer:
+ </p>
+ <p class="command">
+ $ sfi.py version
+ </p>
+ <p>
+ And finally delegate your credentials to the portal
+ </p>
+ <p class="command">
+ $ sfi.py myslice
+ </p>
+ <p>
+ The complete tutorial is available at the following address:
+ <a target="_blank" href="http://trac.myslice.info/wiki/InstallSfa">http://trac.myslice.info/wiki/InstallSfa</a>
+ </p>
+
+ <br />
+
+</div>
+{% endblock %}
+
<p> More Info: <a href="http://myslice.info/" target="_blank">http://myslice.info/</a></p>
<p> Code: <a href="http://git.onelab.eu/?p=myslice.git;a=summary" target="_blank">Git Repository</a> (read only)</p>
<p>
- If you need write access to the git repository you need first to send your public key to <a href="mailto:support@myslice.info">support@myslice.info</a>.
+ If you need write access to the git repository you need first to send your public key to <a href="mailto:support@onelab.eu">support@onelab.eu</a>.
</p>
</div>
</div>
</div>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
Account > <a href="/account">{{ person.email }}</a>
</div>
</div>
+ {%if 'no_creds' in user_cred %}
+ <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">NO CREDENTIALS</a> are delegated to the portal!</p>
+{%endif%}
+
</div>
{% if messages %}
<ul class="messages">
<div class="col-md-12">
<h3>Credentials <small>Delegated to Principal Account</small></h3>
<table class="table">
- {%if 'no_creds' in user_cred %}
- <p><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">NO CREDENTIALS</a> are delegated to the portal!</p>
- {%endif%}
<caption><b>Delegated User Credential</b></caption>
<tr class="odd">
<th>Expiration Date</th>
<p>You may get this message for several reasons.</p>
<h3>Account Delegation: Automatic</h3>
<ul>
+ <li>If your account is not yet validated</li>
<li>If you press the "Clear Credentials" button</li>
<li>If you "Generate a new key pair"</li>
<li>If a new slice is added to your account</li>
<p>In all the above mentioned cases, it is sufficient to refresh the page or go back to home page. The portal will regenrate your credentials.
In some cases it may take more time than usual. If nothing works, then please logout and login again to the portal.</p>
<h3>Account Delegation: Manual</h3>
+ <p>First of all your account needs to be validated by the manager of your organization.</p>
<p>As you have uploaded your own public key, the portal can no longer generate your credentials automatically.</p>
<p>In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to
- <a href="http://trac.myslice.info/wiki/InstallSfa" target="_blank">delegate your credentials to the portal.</a>
+ <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a>
</p>
<h5>Contact support</h5>
<p>If you don't have the above mentioned cases and still have this message, please <a href="/contact/" target="_blank">contact us</a>.</p>
{% widget '_widget-news.html' %}
</div> -->
{% if username %}
+<!-- Modal- No credentials -->
+<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+ <h4 class="modal-title" id="myModalLabel">No credentials are delegated to the portal</h4>
+ </div>
+ <div class="modal-body">
+ <p>You may get this message for several reasons.</p>
+ <h3>Account Delegation: Automatic</h3>
+ <ul>
+ <li>If your account is not yet validated</li>
+ <li>If you press the "Clear Credentials" button</li>
+ <li>If you "Generate a new key pair"</li>
+ <li>If a new slice is added to your account</li>
+ </ul>
+ <p>In all the above mentioned cases, it is sufficient to refresh the page or go back to home page. The portal will regenrate your credentials.
+ In some cases it may take more time than usual. If nothing works, then please logout and login again to the portal.</p>
+ <h3>Account Delegation: Manual</h3>
+ <p>First of all your account needs to be validated by the manager of your organization.</p>
+ <p>As you have uploaded your own public key, the portal can no longer generate your credentials automatically.</p>
+ <p>In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to
+ <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a>
+ </p>
+ <h5>Contact support</h5>
+ <p>If you don't have the above mentioned cases and still have this message, please <a href="/contact/" target="_blank">contact us</a>.</p>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ </div>
+ </div>
+ </div>
+</div>
<div class="container dashboard">
+ {%if 'no_creds' in user_cred %}
+ <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">NO CREDENTIALS</a> are delegated to the portal!</p>
+ {%endif%}
+
<div class="row">
{%if 'is_pi' in pi %}
<div class="col-md-3">
<br />
<div class="alert alert-danger" id="pkey_del_msg">
In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to
- <a href="http://trac.myslice.info/wiki/InstallSfa" target="_blank">delegate your credentials to the portal.</a>
+ <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a>
</div>
</div>
</div>
#from portal.experimentview import ExperimentView
from portal.termsview import TermsView
from portal.univbrisview import UnivbrisView
+from portal.manualdelegationview import ManualDelegationView
from portal.servicedirectory import ServiceDirectoryView
# Slice request
url(r'^slice_request/?$', SliceRequestView.as_view(), name='slice_request'),
url(r'^terms/?$', TermsView.as_view(), name='terms'),
+ url(r'^manual_delegation/?$', ManualDelegationView.as_view(), name='manual_delegation'),
# Validate pending requests
url(r'^validate/?$', ValidatePendingView.as_view()),
# http://stackoverflow.com/questions/2360179/django-urls-how-to-pass-a-list-of-items-via-clean-urls