from myslice.settings import config, logger, DEBUG
-from unfold.sessioncache import SessionCache
+# from unfold.sessioncache import SessionCache
# Name my backend 'ManifoldBackend'
class ManifoldBackend:
logger.error("GetSession failed: {}".format(sessions_result.error()))
return
session = sessions[0]
- logger.debug("SESSION : {}".format(session))
+ logger.debug("SESSION : {}".format(session.keys()))
# Change to session authentication
- session_auth = {'AuthMethod': 'session', 'session': session['session']}
- api.auth = session_auth
+ api.auth = {'AuthMethod': 'session', 'session': session['session']}
+ #api.auth = session_auth
self.api = api
# Get account details
return
person = persons[0]
logger.debug("PERSON : {}".format(person))
+
+ request.session['manifold'] = {'auth': api.auth, 'person': person, 'expires': session['expires']}
+
#logger.info("{} {} <{}> logged in"\
# .format(person['config']['first_name'], person['config']['last_name'], person['config']['email']))
- SessionCache().store_auth(request, session_auth)
+ #SessionCache().store_auth(request, session_auth)
except ManifoldException as e:
logger.error("ManifoldException in Auth Backend: {}".format(e.manifold_result))
from manifold.core.result_value import ResultValue
from manifoldresult import ManifoldResult, ManifoldCode, ManifoldException, truncate_result
-from unfold.sessioncache import SessionCache
+# from unfold.sessioncache import SessionCache
from myslice.settings import config, logger
# but most importantly there is a need to refine that test, since
# code==2 does not necessarily mean an expired session
# XXX only if we know it is the issue
- SessionCache().end_session(request)
+ #SessionCache().end_session(request)
# Flush django session
+ del request.session['manifold']
+
request.session.flush()
#raise Exception, 'Error running query: {}'.format(result)
def execute_query(request, query):
- manifold_api_session_auth = SessionCache().get_auth(request)
- if not manifold_api_session_auth:
+ logger.debug("EXECUTE QUERY: request - {}".format(request.session.items()))
+
+ if not 'manifold' in request.session or not 'auth' in request.session['manifold']:
+ #manifold_api_session_auth = SessionCache().get_auth(request)
+ #if not manifold_api_session_auth:
request.session.flush()
#raise Exception, "User not authenticated"
host = request.get_host()
return redirect('/')
+ manifold_api_session_auth = request.session['manifold']['auth']
+
return _execute_query(request, query, manifold_api_session_auth)
def execute_admin_query(request, query):
from manifoldresult import ManifoldException
from manifold.util.log import Log
-from unfold.sessioncache import SessionCache
+# from unfold.sessioncache import SessionCache
from myslice.settings import config, logger
admin_user, admin_password = config.manifold_admin_user_password()
manifold_api_session_auth = {'AuthMethod': 'password', 'Username': admin_user, 'AuthString': admin_password}
else:
- manifold_api_session_auth = SessionCache().get_auth(request)
- if not manifold_api_session_auth:
+ if 'manifold' in request.session:
+ manifold_api_session_auth = request.session['manifold']['auth']
+ else:
+ #manifold_api_session_auth = SessionCache().get_auth(request)
+ #if not manifold_api_session_auth:
return HttpResponse (json.dumps({'code':0,'value':[]}), content_type="application/json")
if debug_empty and manifold_query.action.lower()=='get':
private_key = account_config['user_private_key']
user_hrn = account_config.get('user_hrn','N/A')
platform_detail = get_myslice_platform(request)
- #registry = get_registry_url(request)
- registry = 'http://sfa-fed4fire.pl.sophia.inria.fr:12345/'
+ registry = get_registry_url(request)
+ #registry = 'http://sfa-fed4fire.pl.sophia.inria.fr:12345/'
jfed_identity = user_hrn + '\n' + registry + '\n' + private_key
return jfed_identity
else:
letter-spacing:0.6pt;
color:#201E62;
}
+h4 {
+ font-size:12pt;
+ letter-spacing:0.6pt;
+ color:#201E62;
+}
input[type=checkbox] {
min-width:5px !important;
margin-left:0 !important;
color:black;
}
+div.home {
+ padding-top:50px;
+}
+div.home h1 {
+ font-size:22pt;
+ border:0;
+}
+div.home h3, div.home h4 {
+ color:#424242;
+ line-height:1.4em;
+}
+div.home h3 a {
+ color:#FD6D2C;
+}
div.dashboard {
}
div.dashboard a {
- color:black;
+ color:#206090;
}
div.dashboard a:hover {
+ text-decoration:underline;
+}
+div.dashboard div.projects-tree {
+ margin-left:15px;
}
div.dashboard ul {
+ list-style-type:disc;
+ list-style-position:inside;
text-align:left;
- margin-left:24px;
+ margin:0 0 15px 4px;
+ padding:0;
+}
+div.dashboard ul ul {
+ margin:5px 0 15px 25px;
list-style:none;
}
+div.dashboard li {
+ margin:0 0 5px 0;
+ padding:0;
+}
+div.dashboard ul ul li {
+ margin:0;
+}
+div.dashboard ul ul a {
+}
div.dashboard h3 {
border-bottom:0.5px solid #E0E0E0;
margin-right:15px;
+ margin-bottom:25px;
}
div.dashboard h3 img {
margin:15px 15px 15px 0;
}
-
+div.dashboard span.glyphicon {
+ text-align:center;
+ width:45px;
+ height:25px;
+}
+div.experiment-tools {
+
+}
+div.experiment-tools h4 {
+ border-bottom:0.5px solid #E0E0E0;
+ margin:25px 15px 25px 0;
+ padding-bottom:5px;
+}
+div.experiment-tools p {
+ text-align:center;
+}
+#webstart-button {
+ margin-right:25px;
+ width:150px;
+ color:white;
+}
+#webstart-button:hover {
+ text-decoration:none;
+}
+#webstart-button span {
+ width:20px;
+ height:10px;
+}
div.dataTables_filter label{
float:left;
<a href="/portal/slice_request"><img src="{{ STATIC_URL }}img/icon_slices_small.png" alt="" /></a>EXPERIMENT
</h3>
- <div>
+ <div class="projects-tree">
Your projects and slices
<span title="A <b>slice</b> is a set of testbed resources on which you can conduct an experiment.
Either ask your colleagues to give you access to an existing slice or request a new slice by clicking 'Request Slice'.
However, on the Fed4FIRE portal, you will only see slices that you have created through Fed4FIRE. If you have created slices elsewhere,
those slices will not appear here. <br /><br /> A <b>project</b> is a sub-authority under the responsability of your institution gathering users,
who will be able to create slices for their experiments." class="glyphicon glyphicon-info-sign"> </span>
- </div>
-
- <div>
+
<div id="home-project-tree"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading projects" /></div>
</div>
<div>
<span class="glyphicon glyphicon-plus"></span> <a href="/portal/slice_request/">Create slice</a>
+ <br />
<span class="glyphicon glyphicon-cog"></span> <a href="/portal/project_request/">Create/Join project</a>
</div>
</div>
<div class="col-sm-4">
<div class="row">
- <h3>
- <a href="/portal/account/"><img src="{{ STATIC_URL }}img/icon_user_small.png" alt="" /></a>ACCOUNT
- </h3>
- {% if person.last_name %}
- <p>
- {{person.first_name}} {{person.last_name}}
- </p>
- {% endif %}
- <p>
- <span class="glyphicon glyphicon-user"></span> <a href='/portal/account/' title="Click here to see and edit your account details.">{{person.email}}</a>
- </p>
+ <div class="col-sm-12">
+ <h3>
+ <a href="/portal/account/"><img src="{{ STATIC_URL }}img/icon_user_small.png" alt="" /></a>ACCOUNT
+ </h3>
+ {% if person.last_name %}
+ <p>
+ {{person.first_name}} {{person.last_name}}
+ </p>
+ {% endif %}
+ <p>
+ <span class="glyphicon glyphicon-user"></span> <a href='/portal/account/' title="Click here to see and edit your account details.">{{person.email}}</a>
+ </p>
+ </div>
</div>
<div class="row">
- <h3>
- <a href="/portal/institution"><img src="{{ STATIC_URL }}img/icon_authority_color_small.png" alt="" /></a>MANAGEMENT
- </h3>
-
- <div>
- <span class="glyphicon glyphicon-ok"></span> <a href="/portal/institution#requests">Validate Requests</a>
+ <div class="col-sm-12">
+ <h3>
+ <a href="/portal/institution"><img src="{{ STATIC_URL }}img/icon_authority_color_small.png" alt="" /></a>MANAGEMENT
+ </h3>
+
+ <div>
+ <span class="glyphicon glyphicon-ok"></span> <a href="/portal/institution#requests">Validate Requests</a>
+ </div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="row">
- <h3>
- <a href="/portal/support"><img src="{{ STATIC_URL }}img/icon_support_small.png" alt="" /></a>SUPPORT
- </h3>
- <p>
- <span class="glyphicon glyphicon-envelope"></span> <a href="/portal/contact/">Contact</a>
- </p>
- <p>
- <span class="glyphicon glyphicon-stats"></span> <a target="_blank" href="https://flsmonitor.fed4fire.eu">Testbeds' status</a>
- </br />
- <span class="glyphicon glyphicon-stats"></span> <a href="/portal/reputation">Testbeds' reputation</a>
-
- </p>
- <p>
- <span class="glyphicon glyphicon-book"></span> <a target="_blank" href="http://doc.fed4fire.eu/">Documentation</a>
- </p>
-
- </div>
-
-
+ <div class="col-sm-12">
+ <h3>
+ <a href="/portal/support"><img src="{{ STATIC_URL }}img/icon_support_small.png" alt="" /></a>SUPPORT
+ </h3>
+ <p>
+ <span class="glyphicon glyphicon-envelope"></span> <a href="/portal/contact/">Contact</a>
+ </p>
+ <p>
+ <span class="glyphicon glyphicon-stats"></span> <a target="_blank" href="https://flsmonitor.fed4fire.eu">Testbeds' status</a>
+ </br />
+ <span class="glyphicon glyphicon-stats"></span> <a href="/portal/reputation">Testbeds' reputation</a>
+
+ </p>
+ <p>
+ <span class="glyphicon glyphicon-book"></span> <a target="_blank" href="http://doc.fed4fire.eu/">Documentation</a>
+ </p>
+ </div>
+ </div>
</div>
</div>
</div>
{% else %}
-<div class="container-fluid home">
+<div class="container home">
<div class="">
- <div class="col-sm-2"></div>
- <div class="col-sm-4 slogan">
- <h2>
+ <div class="col-sm-4 col-sm-offset-1 slogan">
+ <h1>
Fed4FIRE Portal
- </h2>
+ </h1>
<h3>
- Your easy access to Future Internet Research and Experimentation testbeds belonging to the Fed4FIRE federation.
+ Your easy access to Future Internet Research and Experimentation testbeds belonging to the
+ <a target="_blank" href="http://www.fed4fire.eu/">Fed4FIRE</a> federation.
</h3>
- <h3>
+ <br />
+ <h4>
<a href='http://doc.fed4fire.eu'>Want to learn more?</a>
- </h3>
+ </h4>
</div>
<div class="col-sm-4 col-sm-offset-1" style="width:400px; top:16px; float:left;">
<div class="row">
{% widget '_widget-login-user.html' %}
</div>
</div>
- <div class="col-sm-1"></div>
</div>
</div>
{% endif %}
# needs to be called explicitly and only when metadata is actually required
# in particular user needs to be logged
def get_metadata (self):
- cached_metadata = SessionCache().get_metadata(self.request)
- if cached_metadata and isinstance(cached_metadata, MetaData):
+ # look in session's cache - we don't want to retrieve this for every request
+ session=self.request.session
+
+ if 'manifold' not in session:
+ session['manifold'] = {}
+ manifold = session['manifold']
+
+ # if cached, use it
+ if 'metadata' in manifold and isinstance(manifold['metadata'],MetaData):
+
+# cached_metadata = SessionCache().get_metadata(self.request)
+# if cached_metadata and isinstance(cached_metadata, MetaData):
logger.debug("Page.get_metadata: return cached value")
- return cached_metadata
+ return manifold['metadata']
+# return cached_metadata
metadata_auth = {'AuthMethod':'anonymous'}
metadata = MetaData (metadata_auth)
metadata.fetch(self.request)
- SessionCache().store_metadata(self.request, metadata)
+ # store it for next time
+ manifold['metadata']=metadata
+# SessionCache().store_metadata(self.request, metadata)
logger.debug("Page.get_metadata: return new value")
return metadata