--- /dev/null
+unfold.wsgi
\ No newline at end of file
--- /dev/null
+NameVirtualHost *:80
+<VirtualHost *:80>
+ ServerName 200.130.15.182
+ ServerSignature Off
+
+ # Redirecionamento para SSL
+ #RewriteEngine on
+ #RewriteCond %{HTTPS} !=on
+ #RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]
+
+ DocumentRoot /var/www/
+ <Directory /var/www/>
+ Options Indexes FollowSymLinks MultiViews
+ AllowOverride None
+ Order allow,deny
+ allow from all
+ </Directory>
+
+ ErrorLog /var/log/apache2/error.log
+ # Possible values include: debug, info, notice, warn, error, crit,
+ # alert, emerg.
+ LogLevel info
+ CustomLog /var/log/apache2/sp-access-80.log combined
+</VirtualHost>
--- /dev/null
+NameVirtualHost *:443
+<IfModule mod_ssl.c>
+<VirtualHost *:443>
+ ServerAdmin support-myslice@myslice.info
+ ServerName portal.fibre.br
+
+ DocumentRoot /var/www/myslice
+ WSGIScriptAlias / /var/www/myslice/apache/unfold.wsgi
+
+ <Directory /var/www/myslice>
+ Options Indexes FollowSymLinks MultiViews
+ AllowOverride All
+ Order allow,deny
+ allow from all
+ </Directory>
+
+ Alias /static/ /var/www/myslice/static/
+ <Directory /var/www/myslice/static>
+ Order deny,allow
+ Allow from all
+ </Directory>
+
+ #Alias /certificates/ /var/certificates-f4f/
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+
+ LogLevel warn
+
+ CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
+
+ # SSL
+ SSLEngine on
+ SSLProtocol all -SSLv2
+ SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
+ SSLCertificateKeyFile /etc/ssl/private/fibre.key
+ SSLCertificateFile /etc/ssl/certs/fibre.crt
+ SSLOptions +StdEnvVars +ExportCertData
+ SSLCACertificatePath /etc/sfa/trusted_roots
+ SSLVerifyClient optional_no_ca
+ #SSLVerifyClient require
+ SSLVerifyDepth 5
+ ServerSignature On
+
+ <FilesMatch "\.(cgi|shtml|phtml|php)$">
+ SSLOptions +StdEnvVars
+ </FilesMatch>
+ <Directory /usr/lib/cgi-bin>
+ SSLOptions +StdEnvVars
+ </Directory>
+
+ BrowserMatch "MSIE [2-6]" \
+ nokeepalive ssl-unclean-shutdown \
+ downgrade-1.0 force-response-1.0
+ BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
+
+</VirtualHost>
+</IfModule>
--- /dev/null
+<VirtualHost 200.130.15.182:443>
+ ServerName 200.130.15.182
+ ServerSignature Off
+
+ SSLEngine on
+ #SSLCertificateFile /etc/unfold/trusted_roots
+ SSLCertificateFile /etc/ssl/certs/fibre.crt
+ SSLCertificateKeyFile /etc/ssl/private/fibre.key
+
+ #ShibURLScheme https
+
+ DocumentRoot /var/www/
+ <Directory /var/www/>
+ Options -Indexes FollowSymLinks -MultiViews
+ AllowOverride None
+ Order deny,allow
+ Allow from all
+ </Directory>
+
+# WSGIScriptAlias / /usr/share/unfold/apache/myslice.wsgi
+# <Directory /usr/share/unfold/apache>
+# <Files myslice.wsgi>
+# Order deny,allow
+# Allow from all
+# </Files>
+# </Directory>
+# Alias /static/ /usr/share/unfold/static/
+# <Directory /usr/share/unfold/static>
+# Order deny,allow
+# Allow from all
+# </Directory>
+
+
+#<Location myslice/secure>
+# AuthType Shibboleth
+# ShibRequestSetting requireSession true
+# ShibRequestSetting applicationId default
+# Require valid-user
+#</Location>
+
+<Location /Shibboleth.sso>
+ SetHandler shib
+</Location>
+<Location /shibboleth-sp2>
+ SetHandler shib
+</Location>
+
+
+# <Location /moodle/auth/shibboleth>
+# AuthType shibboleth
+# ShibRequireSession On
+# require valid-user
+# </Location>
+
+ # Possible values include: debug, info, notice, warn, error, crit,
+ # alert, emerg.
+ ErrorLog /var/log/apache2/error.log
+ LogLevel info
+ CustomLog /var/log/apache2/sp-access-443.log combined
+
+</VirtualHost>
# see also unfold-ssl.conf
<VirtualHost *:80>
- WSGIDaemonProcess unfold processes=2 threads=25
- WSGIProcessGroup unfold
- CustomLog ${APACHE_LOG_DIR}/unfold-access.log common
- ErrorLog ${APACHE_LOG_DIR}/unfold-error.log
- WSGIScriptAlias / /usr/share/unfold/apache/unfold.wsgi
- <Directory /usr/share/unfold/apache/>
- <Files unfold.wsgi>
+ WSGIDaemonProcess myslice processes=2 threads=25
+ WSGIProcessGroup myslice
+ CustomLog ${APACHE_LOG_DIR}/myslice-access.log common
+ ErrorLog ${APACHE_LOG_DIR}/myslice-error.log
+ WSGIScriptAlias / /var/www/myslice/apache/myslice.wsgi
+ <Directory /var/www/myslice/myslice/apache/>
+ <Files myslice.wsgi>
Order deny,allow
Allow from all
</Files>
</Directory>
- Alias /static/ /usr/share/unfold/static/
- <Directory /usr/share/unfold/static>
+ Alias /static/ /var/www/myslice/myslice/static/
+ <Directory /var/www/myslicee/myslice/static>
Order deny,allow
Allow from all
</Directory>
import os
import sys
-path = '/var/myslice-f4f'
+#site.addsitedir('/var/www/myslice')
+
+path = '/var/www/myslice'
if path not in sys.path:
- sys.path.append(path)
+ sys.path = [path] + sys.path
+print sys.path
os.environ['DJANGO_SETTINGS_MODULE'] = 'myslice.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
-
--- /dev/null
+import time
+
+# import ldap for LDAP authentication - Edelberto
+import ldap
+
+from django.contrib.auth.models import User
+
+from manifoldapi.manifoldapi import ManifoldAPI, ManifoldException, ManifoldResult
+from manifold.core.query import Query
+
+# Name my backend 'ManifoldBackend'
+class ManifoldBackend:
+
+
+ # Create an authentication method
+ # This is called by the standard Django login procedure
+ def authenticate(self, token=None):
+
+ # LDAP local/global var
+ checkldap = None
+
+ if not token:
+ return None
+
+ try:
+ #usernameldap is from LDAP user form. If it is filled - See portal/homeview.py too
+ usernameldap = token['usernameldap']
+ username = token['username']
+ password = token['password']
+ request = token['request']
+
+ # if data are not from LDAP form then normal (local) login
+ if not usernameldap:
+ auth = {'AuthMethod': 'password', 'Username': username, 'AuthString': password}
+ api = ManifoldAPI(auth)
+ sessions_result = api.forward(Query.create('local:session').to_dict())
+ print "result"
+ sessions = sessions_result.ok_value()
+ print "ok"
+ if not sessions:
+ print "GetSession failed", sessions_result.error()
+ return
+ print "first", sessions
+ session = sessions[0]
+
+ # Change to session authentication
+ api.auth = {'AuthMethod': 'session', 'session': session['session']}
+ self.api = api
+
+ # Get account details
+ # the new API would expect Get('local:user') instead
+ persons_result = api.forward(Query.get('local:user').to_dict())
+ persons = persons_result.ok_value()
+ if not persons:
+ print "GetPersons failed",persons_result.error()
+ return
+ person = persons[0]
+ print "PERSON=", person
+
+ request.session['manifold'] = {'auth': api.auth, 'person': person, 'expires': session['expires']}
+ ################################
+ # Edelberto LDAP authentication
+ # if data are from LDAP form, so
+ else:
+ # XXX UGLY
+ # Needing to create an specific entries at settings.py (or myslice.ini) for these vars
+ ##################################################
+ # Edelberto - UFF - esilva@ic.uff.br
+ # v1 - ldap authentication module
+ # Note: focus on LDAP FIBRE-BR for DN
+ # if uses other DN, configuration are needed
+ ###################################################
+ #Searching an LDAP Directory
+
+ try:
+ #uid = "debora@uff.br"
+
+ # Receiving an email address, how can we split and mount it in DN format?
+ #mail = "debora@uff.br"
+ mail = usernameldap
+ login = mail.split('@')[0]
+ org = mail.split('@')[1]
+ o = org.split('.')[0]
+ dc = org.split('.')[1]
+ '''
+ print mail
+ print login
+ print org
+ print o
+ print dc
+ '''
+
+ # DN format to authenticate - IMPORTANT!
+ #FIBRE-BR format
+ uid = "uid="+mail+",ou=people,o="+o+",dc="+dc
+ #uid = "uid=debora@uff.br,ou=people,o=uff,dc=br"
+ # User password from LDAP form
+ #userPassword = "fibre"
+ userPassword = password
+
+ # testing with:
+ # wrong password for test
+ # userPassword = "fibre2"
+
+ # Parameters to connect on LDAP
+ ldap.set_option(ldap.OPT_REFERRALS, 0)
+ # LDAP Server Address
+ l = ldap.open("127.0.0.1")
+ # LDAP version
+ l.protocol_version = ldap.VERSION3
+
+ #l.simple_bind(uid, userPassword)
+ # l.bind_s is necessary to do the authentication with a normal LDAP user
+ l.bind_s(uid, userPassword, ldap.AUTH_SIMPLE)
+ #print l.bind_s(uid, userPassword, ldap.AUTH_SIMPLE)
+
+ # DN base - Our root dc (dc=br)
+ baseDN="dc="+dc
+ searchScope = ldap.SCOPE_SUBTREE
+ retrieveAttributes = None
+ # User only can see its credentials. He search only his attributes
+ searchFilter = "uid="+mail
+
+ # Getting all attributes
+ try:
+ ldap_result_id = l.search(baseDN, searchScope, searchFilter, retrieveAttributes)
+ result_set = []
+ # while exist attributes, save them in a list!
+ while 1:
+ # print l.result(ldap_result_id, 0)
+ result_type, result_data = l.result(ldap_result_id, 0)
+ if (result_data == []):
+ #print ("User %s don't allowed to bind in LDAP", uid)
+ break
+ else:
+ ## Appendng to a list
+ if result_type == ldap.RES_SEARCH_ENTRY:
+ result_set.append(result_data)
+ # print result_set
+ except ldap.LDAPError, e:
+ print e
+
+ # Matching if the user is really who his say
+ #checkldap = None
+ if l.compare_s(uid, 'uid', mail):
+ # DEBUG
+ checkldap = True
+ print "match"
+
+ # Now, based on default Manifold Auth
+ auth = {'AuthMethod': 'password', 'Username': usernameldap, 'AuthString': password}
+ api = ManifoldAPI(auth)
+ sessions_result = api.forward(Query.create('local:session').to_dict())
+ print "result"
+ sessions = sessions_result.ok_value()
+ print "ok"
+ if not sessions:
+ print "GetSession failed", sessions_result.error()
+ return
+ print "first", sessions
+ session = sessions[0]
+
+ # Change to session authentication
+ api.auth = {'AuthMethod': 'session', 'session': session['session']}
+ self.api = api
+
+ # Get account details
+ # the new API would expect Get('local:user') instead
+ persons_result = api.forward(Query.get('local:user').to_dict())
+ persons = persons_result.ok_value()
+ if not persons:
+ print "GetPersons failed",persons_result.error()
+ return
+ person = persons[0]
+ print "PERSON=", person
+
+ request.session['manifold'] = {'auth': api.auth, 'person': person, 'expires': session['expires']}
+
+ else:
+ print "no match. User doesnt allowed"
+ checkldap = False
+
+ except ldap.LDAPError, e:
+ print "E: LDAP Search user", e
+ # end of LDAP
+
+ # Follow the same of Manifold
+ except ManifoldException, e:
+ print "ManifoldBackend.authenticate caught ManifoldException, returning corresponding ManifoldResult"
+ return e.manifold_result
+ except Exception, e:
+ print "E: manifoldbackend", e
+ import traceback
+ traceback.print_exc()
+ return None
+
+ if not usernameldap:
+ try:
+ # Check if the user exists in Django's local database
+ user = User.objects.get(username=username)
+ except User.DoesNotExist:
+ # Create a user in Django's local database
+ user = User.objects.create_user(username, usernamep, 'passworddoesntmatter')
+ user.first_name = "DUMMY_FIRST_NAME" #person['first_name']
+ user.last_name = "DUMMY LAST NAME" # person['last_name']
+ user.email = person['email']
+ return user
+ else:
+ if checkldap:
+ try:
+ # Check if the user exists in Django's local database
+ user = User.objects.get(username=usernameldap)
+ except User.DoesNotExist:
+ # Create a user in Django's local database
+ user = User.objects.create_user(username, usernameldap, 'passworddoesntmatter')
+ user.first_name = "DUMMY_FIRST_NAME" #person['first_name']
+ user.last_name = "DUMMY LAST NAME" # person['last_name']
+ user.email = person['email']
+ return user
+
+ # Required for your backend to work properly - unchanged in most scenarios
+ def get_user(self, user_id):
+ try:
+ return User.objects.get(pk=user_id)
+ except User.DoesNotExist:
+ return None
+
+
import time
+# import ldap for LDAP authentication - Edelberto
+import ldap
+
from django.contrib.auth.models import User
from manifoldapi.manifoldapi import ManifoldAPI, ManifoldException, ManifoldResult
# Name my backend 'ManifoldBackend'
class ManifoldBackend:
+
# Create an authentication method
# This is called by the standard Django login procedure
def authenticate(self, token=None):
+
+ # LDAP local/global var
+ checkldap = None
+
if not token:
return None
try:
+ print "ManifoldBackend authenticate()"
+ # Mandatory fields in token
username = token['username']
- password = token['password']
request = token['request']
- auth = {'AuthMethod': 'password', 'Username': username, 'AuthString': password}
- api = ManifoldAPI(auth)
- sessions_result = api.forward(Query.create('local:session').to_dict())
- print "result"
- sessions = sessions_result.ok_value()
- print "ok"
- if not sessions:
- print "GetSession failed", sessions_result.error()
- return
- print "first", sessions
- session = sessions[0]
-
- # Change to session authentication
- api.auth = {'AuthMethod': 'session', 'session': session['session']}
- self.api = api
-
- # Get account details
- # the new API would expect Get('local:user') instead
- persons_result = api.forward(Query.get('local:user').to_dict())
- persons = persons_result.ok_value()
- if not persons:
- print "GetPersons failed",persons_result.error()
- return
- person = persons[0]
- print "PERSON=", person
-
- request.session['manifold'] = {'auth': api.auth, 'person': person, 'expires': session['expires']}
+ # usernameldap is optional - from LDAP user form.
+ # If it is filled - See portal/homeview.py too
+ if 'usernameldap' in token:
+ usernameldap = token['usernameldap']
+ else:
+ usernameldap = None
+ password = token['password']
+ # if data are not from LDAP form then normal (local) login
+ if not usernameldap:
+ print "not userldap ManifoldBackend authenticate()"
+ auth = {'AuthMethod': 'password', 'Username': username, 'AuthString': password}
+ api = ManifoldAPI(auth)
+ sessions_result = api.forward(Query.create('local:session').to_dict())
+ print "result"
+ sessions = sessions_result.ok_value()
+ print "ok"
+ if not sessions:
+ print "GetSession failed", sessions_result.error()
+ return
+ print "first", sessions
+ session = sessions[0]
+
+ # Change to session authentication
+ api.auth = {'AuthMethod': 'session', 'session': session['session']}
+ self.api = api
+
+ # Get account details
+ # the new API would expect Get('local:user') instead
+ persons_result = api.forward(Query.get('local:user').to_dict())
+ persons = persons_result.ok_value()
+ if not persons:
+ print "GetPersons failed",persons_result.error()
+ return
+ person = persons[0]
+ print "PERSON=", person
+
+ request.session['manifold'] = {'auth': api.auth, 'person': person, 'expires': session['expires']}
+ ################################
+ # Edelberto LDAP authentication
+ # if data are from LDAP form, so
+ else:
+ print "userldap ManifoldBackend authenticate()"
+ # XXX UGLY
+ # Needing to create an specific entries at settings.py (or myslice.ini) for these vars
+ ##################################################
+ # Edelberto - UFF - esilva@ic.uff.br
+ # v1 - ldap authentication module
+ # Note: focus on LDAP FIBRE-BR for DN
+ # if uses other DN, configuration are needed
+ ###################################################
+ #Searching an LDAP Directory
+
+ try:
+ #uid = "debora@uff.br"
+
+ # Receiving an email address, how can we split and mount it in DN format?
+ #mail = "debora@uff.br"
+ mail = usernameldap
+ login = mail.split('@')[0]
+ org = mail.split('@')[1]
+ o = org.split('.')[0]
+ dc = org.split('.')[1]
+ '''
+ print mail
+ print login
+ print org
+ print o
+ print dc
+ '''
+
+ # DN format to authenticate - IMPORTANT!
+ #FIBRE-BR format
+ uid = "uid="+mail+",ou=people,o="+o+",dc="+dc
+ #uid = "uid=debora@uff.br,ou=people,o=uff,dc=br"
+ # User password from LDAP form
+ #userPassword = "fibre"
+ userPassword = password
+
+ # testing with:
+ # wrong password for test
+ # userPassword = "fibre2"
+
+ # Parameters to connect on LDAP
+ ldap.set_option(ldap.OPT_REFERRALS, 0)
+ # LDAP Server Address
+ l = ldap.open("127.0.0.1")
+ # LDAP version
+ l.protocol_version = ldap.VERSION3
+
+ #l.simple_bind(uid, userPassword)
+ # l.bind_s is necessary to do the authentication with a normal LDAP user
+ l.bind_s(uid, userPassword, ldap.AUTH_SIMPLE)
+ #print l.bind_s(uid, userPassword, ldap.AUTH_SIMPLE)
+
+ # DN base - Our root dc (dc=br)
+ baseDN="dc="+dc
+ searchScope = ldap.SCOPE_SUBTREE
+ retrieveAttributes = None
+ # User only can see its credentials. He search only his attributes
+ searchFilter = "uid="+mail
+
+ # Getting all attributes
+ try:
+ ldap_result_id = l.search(baseDN, searchScope, searchFilter, retrieveAttributes)
+ result_set = []
+ # while exist attributes, save them in a list!
+ while 1:
+ # print l.result(ldap_result_id, 0)
+ result_type, result_data = l.result(ldap_result_id, 0)
+ if (result_data == []):
+ #print ("User %s don't allowed to bind in LDAP", uid)
+ break
+ else:
+ ## Appendng to a list
+ if result_type == ldap.RES_SEARCH_ENTRY:
+ result_set.append(result_data)
+ # print result_set
+ except ldap.LDAPError, e:
+ print e
+
+ # Matching if the user is really who his say
+ #checkldap = None
+ if l.compare_s(uid, 'uid', mail):
+ # DEBUG
+ checkldap = True
+ print "match"
+
+ # Now, based on default Manifold Auth
+ auth = {'AuthMethod': 'password', 'Username': usernameldap, 'AuthString': password}
+ api = ManifoldAPI(auth)
+ sessions_result = api.forward(Query.create('local:session').to_dict())
+ print "result"
+ sessions = sessions_result.ok_value()
+ print "ok"
+ if not sessions:
+ print "GetSession failed", sessions_result.error()
+ return
+ print "first", sessions
+ session = sessions[0]
+
+ # Change to session authentication
+ api.auth = {'AuthMethod': 'session', 'session': session['session']}
+ self.api = api
+
+ # Get account details
+ # the new API would expect Get('local:user') instead
+ persons_result = api.forward(Query.get('local:user').to_dict())
+ persons = persons_result.ok_value()
+ if not persons:
+ print "GetPersons failed",persons_result.error()
+ return
+ person = persons[0]
+ print "PERSON=", person
+
+ request.session['manifold'] = {'auth': api.auth, 'person': person, 'expires': session['expires']}
+
+ else:
+ print "no match. User doesnt allowed"
+ checkldap = False
+
+ except ldap.LDAPError, e:
+ print "E: LDAP Search user", e
+ # end of LDAP
+
+ # Follow the same of Manifold
except ManifoldException, e:
print "ManifoldBackend.authenticate caught ManifoldException, returning corresponding ManifoldResult"
return e.manifold_result
import traceback
traceback.print_exc()
return None
-
- try:
- # Check if the user exists in Django's local database
- user = User.objects.get(username=username)
- except User.DoesNotExist:
- # Create a user in Django's local database
- user = User.objects.create_user(username, username, 'passworddoesntmatter')
- user.email = person['email']
+
+ if not usernameldap:
+ try:
+ # Check if the user exists in Django's local database
+ user = User.objects.get(username=username)
+ except User.DoesNotExist:
+ # Create a user in Django's local database
+ user = User.objects.create_user(username, usernamep, 'passworddoesntmatter')
+ user.email = person['email']
+ else:
+ if checkldap:
+ try:
+ # Check if the user exists in Django's local database
+ user = User.objects.get(username=usernameldap)
+ except User.DoesNotExist:
+ # Create a user in Django's local database
+ user = User.objects.create_user(username, usernameldap, 'passworddoesntmatter')
+ user.email = person['email']
if 'firstname' in person:
user.first_name = person['firstname']
user.last_name = person['lastname']
return user
-
# Required for your backend to work properly - unchanged in most scenarios
def get_user(self, user_id):
try:
--- /dev/null
+import time
+
+from django.contrib.auth.models import User
+
+from manifoldapi.manifoldapi import ManifoldAPI, ManifoldException, ManifoldResult
+from manifold.core.query import Query
+
+# Name my backend 'ManifoldBackend'
+class ManifoldBackend:
+
+ # Create an authentication method
+ # This is called by the standard Django login procedure
+ def authenticate(self, token=None):
+ if not token:
+ return None
+
+ try:
+ username = token['username']
+ password = token['password']
+ request = token['request']
+
+ auth = {'AuthMethod': 'password', 'Username': username, 'AuthString': password}
+ api = ManifoldAPI(auth)
+ sessions_result = api.forward(Query.create('local:session').to_dict())
+ print "result"
+ sessions = sessions_result.ok_value()
+ print "ok"
+ if not sessions:
+ print "GetSession failed", sessions_result.error()
+ return
+ print "first", sessions
+ session = sessions[0]
+
+ # Change to session authentication
+ api.auth = {'AuthMethod': 'session', 'session': session['session']}
+ self.api = api
+
+ # Get account details
+ # the new API would expect Get('local:user') instead
+ persons_result = api.forward(Query.get('local:user').to_dict())
+ persons = persons_result.ok_value()
+ if not persons:
+ print "GetPersons failed",persons_result.error()
+ return
+ person = persons[0]
+ print "PERSON=", person
+
+ request.session['manifold'] = {'auth': api.auth, 'person': person, 'expires': session['expires']}
+ except ManifoldException, e:
+ print "ManifoldBackend.authenticate caught ManifoldException, returning corresponding ManifoldResult"
+ return e.manifold_result
+ except Exception, e:
+ print "E: manifoldbackend", e
+ import traceback
+ traceback.print_exc()
+ return None
+
+ try:
+ # Check if the user exists in Django's local database
+ user = User.objects.get(username=username)
+ except User.DoesNotExist:
+ # Create a user in Django's local database
+ user = User.objects.create_user(username, username, 'passworddoesntmatter')
+ user.first_name = "DUMMY_FIRST_NAME" #person['first_name']
+ user.last_name = "DUMMY LAST NAME" # person['last_name']
+ user.email = person['email']
+ return user
+
+ # Required for your backend to work properly - unchanged in most scenarios
+ def get_user(self, user_id):
+ try:
+ return User.objects.get(pk=user_id)
+ except User.DoesNotExist:
+ return None
+
+
default_manifold_admin_user = 'admin'
default_manifold_admin_password = 'demo'
- default_myslice_theme = 'onelab'
+ default_myslice_theme = 'fibre'
def __init__ (self):
parser.add_section('googlemap')
parser.set ('googlemap','api_key', None)
+ print os.path.join(ROOT,'myslice/myslice.ini')
parser.read (os.path.join(ROOT,'myslice/myslice.ini'))
+ print parser
self.config_parser=parser
def __getattr__(self, section):
# when deployed from a package
# this code is run by collectstatic too, so we cannot
# assume we have ./static present already
-HTTPROOT="/var/myslice-f4f"
+HTTPROOT="/var/www/myslice"
# the place to store local data, like e.g. the sqlite db
-DATAROOT="/var/unfold"
+DATAROOT="/var/www/myslice"
# if not there, then we assume it's from a devel tree
if not os.path.isdir (os.path.join(HTTPROOT,"static")):
HTTPROOT=ROOT
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'unfold.wsgi.application'
+#WSGI_APPLICATION = 'myslice.wsgi.application'
TEMPLATE_DIRS = [ ]
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# put stuff under static/
# IA_MEDIA_PREFIX = '/code/'
+SESSION_ENGINE = 'django.contrib.sessions.backends.file'
+
####SLA#####
SLA_MANAGER_URL = "http://157.193.215.125:4000/sla-service"
SLA_MANAGER_USER = "normal_user"
-SLA_MANAGER_PASSWORD = "password"
\ No newline at end of file
+SLA_MANAGER_PASSWORD = "password"
import portal.homeview
import portal.newsview
+import plugins.cafe.edelberto
+
from portal.registrationview import RegistrationView
from portal.termsview import TermsView
urls.append ( url ( r'^%s/'%aux, include ('%s.urls'%aux )))
urlpatterns = patterns(*urls)
+
+# Shibboleth - Edelberto
+urlpatterns += patterns('',
+ url(r'^cafe/', plugins.cafe.edelberto.EdelbertoView.as_view()),
+ #url(r'^cafe/', 'plugins.cafe.edelberto.index'),
+)
+
--- /dev/null
+cafe-1.0/
\ No newline at end of file
--- /dev/null
+cafe/
\ No newline at end of file
--- /dev/null
+#!/usr/bin/env python
+
+from portal.models import PendingUser
+#from portal.actions import create_pending_user
+# Edelberto - LDAP
+from portal.actions import create_pending_user, ldap_create_user
+
+#Edelberto from manifoldauth
+import os,sys
+import subprocess
+import shlex
+import getpass
+from hashlib import md5
+import time
+from random import randint
+import crypt
+
+import re
+#from manifold.manifold.core.router import Router
+from manifold.core.query import Query
+from manifoldapi.manifoldapi import execute_admin_query
+#from portal.actions import manifold_add_user, manifold_add_account, manifold_update_account
+from portal.actions import manifold_add_account, manifold_add_reference_user_accounts, sfa_create_user, create_pending_user
+from manifold.core.query import Query
+# add user to manifold
+
+from portal.models import PendingUser
+
+from django.views.generic import View
+from django.core.context_processors import csrf
+from django.contrib.auth import authenticate, login, logout
+from django.template import RequestContext
+from django.shortcuts import render_to_response
+
+from manifold.manifoldresult import ManifoldResult
+from ui.topmenu import topmenu_items, the_user
+from myslice.configengine import ConfigEngine
+
+#from django.http import HttpResponse HttpResponseRedirect
+from django.http import HttpResponse
+#from django.http import HttpResponseRedirect
+#from django.template import RequestContext
+from django.contrib.sessions.backends.db import SessionStore
+
+def index(request):
+#class EdelbertoView (View):
+
+# XXX We use cookie!
+# Test cookie support
+ if request.session.test_cookie_worked():
+ #if session.test_cookie_worked():
+ return HttpResponse("Please enable cookies and try again.")
+ #return
+ print "Please enable cookies and try again."
+ else:
+ request.session['cn'] = request.META['Shib-inetOrgPerson-cn']
+ request.session['sn'] = request.META['Shib-inetOrgPerson-sn']
+ request.session['mail'] = request.META['Shib-inetOrgPerson-mail']
+ request.session['eppn'] = request.META['Shib-eduPerson-eduPersonPrincipalName']
+ #request.session['aff'] = request.META['Shib-brEduPerson-brEduAffiliationType']
+ request.session['aff'] = request.META['Shib-eduPerson-eduPersonAffiliation']
+ request.session['shib'] = request.META['Shib-Session-ID']
+
+ if 'mail' in request.session.keys():
+ print "Cookie: OK -> Content: cn:" + request.session["cn"] + " sn " +request.session["sn"] + " mail: " + request.session["mail"] + " eppn: " + request.session["eppn"]
+ #ip += "Cookie: OK -> Content: cn:" + request.session["cn"] + " mail: " + request.session["mail"] + " eppn: " + request.session["eppn"] + "</body></html>"
+ else:
+ print "Cookie: nothing/clear"
+ #ip += "Cookie: nothing/clear </body></html>"
+
+ # return HttpResponse(ip)
+
+
+ # XXX It's only to test the association of pi and esilva@uff.br
+ if request.session["eppn"] == 'esilva@uff.br':
+ username = 'rezende@ufrj'
+ password = 'fibre2014'
+ # pass request within the token, so manifold session key can be attached to the request session.
+ token = {'username': username, 'password': password, 'request': request}
+ # . a ManifoldResult - when something has gone wrong, like e.g. backend is unreachable
+ # For all users - Verifying if he exists in MySlice/Manifold
+ else:
+ username = request.session["mail"]
+ # this is ugly. We generate a simple password merging mail "fibre" and sn.
+ password = request.session["mail"] + "fibre" + request.session["sn"]
+
+ # If we have " we remove
+ username = username.replace('"','').strip()
+ password = password.replace('"','').strip()
+
+ # pass request within the token, so manifold session key can be attached to the request session.
+ token = {'username': username, 'password': password, 'request': request}
+ # . a ManifoldResult - when something has gone wrong, like e.g. backend is unreachable
+ # . a django User in case of success
+ # . or None if the backend could be reached but the authentication failed
+ auth_result = authenticate(token=token)
+ print auth_result
+ print token
+ # high-level errors, like connection refused or the like
+
+ if isinstance (auth_result, ManifoldResult):
+ manifoldresult = auth_result
+ htm = "<meta http-equiv=\"refresh\" content=\"0; url=https://sp-fibre.cafeexpresso.rnp.br/login-ok\" />"
+ return HttpResponse (htm)
+ # user was authenticated at the backend
+ elif auth_result is not None:
+ user=auth_result
+
+ # Verifying if user is active to logging in
+ if user.is_active:
+ print "LOGGING IN"
+ login(request, user)
+ htm = "<meta http-equiv=\"refresh\" content=\"0; url=https://sp-fibre.cafeexpresso.rnp.br/login-ok\" />"
+ #return HttpResponseRedirect ('/login-ok')
+ return HttpResponse (htm)
+ else:
+ # Today all CAFe accounts are actived
+ htm = "Your account is not active, please contact the site admin."
+ return HttpResponse (htm)
+
+
+ # otherwise
+ # Creating the user at manifold, myslice and sfa
+ else:
+ user_params = { 'email': username, 'password': password }
+ user_request = {}
+
+ user_request['auth_type'] = 'managed'
+
+ # XXX Common code, dependency ?
+ from Crypto.PublicKey import RSA
+ private = RSA.generate(1024)
+
+ # Example: private_key = '-----BEGIN RSA PRIVATE KEY-----\nMIIC...'
+ # Example: public_key = 'ssh-rsa AAAAB3...'
+ user_request['private_key'] = private.exportKey()
+ user_request['public_key'] = private.publickey().exportKey(format='OpenSSH')
+
+ splitmail = username.split("@")[0]
+ user = splitmail.replace('"','').strip()
+ hrn = "fibre." + user + str(randint(1,100000))
+
+ user_request['user_hrn'] = hrn
+
+ user_request['first_name'] = request.session['cn']
+ user_request['last_name'] = request.session['sn']
+ user_request['authority_hrn'] = "fibre"
+ user_request['email'] = username
+ user_request['password'] = password
+ user_request['public_key'] = user_request['public_key']
+ user_request['private_key'] = user_request['private_key']
+
+ # Verify in django
+ if PendingUser.objects.filter(email__iexact = user_request['email']):
+ htm = "Erro - User with same email from CAFe exists in Django"
+ # verify in manifol
+ user_query = Query().get('local:user').select('user_id','email')
+ user_details = execute_admin_query(request, user_query)
+ for user_detail in user_details:
+ if user_detail['email'] == user_request['email']:
+ htm = "Erro - user exist in SFA Registry"
+ try:
+ if user_detail['user_hrn'] == user_request['user_hrn']:
+ htm = "Erro - user with the same hrn in SFA Registry"
+ except:
+ continue
+
+
+ create_pending_user(user_request, user_request, user_detail)
+
+ return HttpResponse(htm)
+ return HttpResponse(htm)
--- /dev/null
+#!/usr/bin/env python
+
+from portal.models import PendingUser
+#from portal.actions import create_pending_user
+# Edelberto - LDAP
+from portal.actions import create_pending_user, ldap_create_user
+
+#Edelberto from manifoldauth
+import os,sys
+import subprocess
+import shlex
+import getpass
+from hashlib import md5
+import time
+from random import randint
+import crypt
+
+import re
+#from manifold.manifold.core.router import Router
+from manifold.core.query import Query
+from manifoldapi.manifoldapi import execute_admin_query, execute_query
+#from portal.actions import manifold_add_user, manifold_add_account, manifold_update_account
+from portal.actions import manifold_add_account, manifold_add_reference_user_accounts, sfa_create_user, create_pending_user
+from manifold.core.query import Query
+# add user to manifold
+
+from unfold.loginrequired import FreeAccessView
+
+from portal.models import PendingUser
+
+from django.views.generic import View
+from django.core.context_processors import csrf
+from django.contrib.auth import authenticate, login, logout
+from django.template import RequestContext
+from django.shortcuts import render_to_response
+
+from manifoldapi.manifoldresult import ManifoldResult
+from ui.topmenu import topmenu_items, the_user
+from myslice.configengine import ConfigEngine
+
+#from django.http import HttpResponse HttpResponseRedirect
+from django.http import HttpResponse
+#from django.http import HttpResponseRedirect
+#from django.template import RequestContext
+from django.contrib.sessions.backends.db import SessionStore
+
+def index(request):
+#class EdelbertoView (View):
+
+# XXX We use cookie!
+# Test cookie support
+ if request.session.test_cookie_worked():
+ #if session.test_cookie_worked():
+ return HttpResponse("Please enable cookies and try again.")
+ #return
+ print "Please enable cookies and try again."
+ else:
+ request.session['cn'] = request.META['Shib-inetOrgPerson-cn']
+ request.session['sn'] = request.META['Shib-inetOrgPerson-sn']
+ request.session['mail'] = request.META['Shib-inetOrgPerson-mail']
+ request.session['eppn'] = request.META['Shib-eduPerson-eduPersonPrincipalName']
+ #request.session['aff'] = request.META['Shib-brEduPerson-brEduAffiliationType']
+ request.session['aff'] = request.META['Shib-eduPerson-eduPersonAffiliation']
+ request.session['shib'] = request.META['Shib-Session-ID']
+
+ if 'mail' in request.session.keys():
+ print "Cookie: OK -> Content: cn:" + request.session["cn"] + " sn " +request.session["sn"] + " mail: " + request.session["mail"] + " eppn: " + request.session["eppn"]
+ #ip += "Cookie: OK -> Content: cn:" + request.session["cn"] + " mail: " + request.session["mail"] + " eppn: " + request.session["eppn"] + "</body></html>"
+ else:
+ print "Cookie: nothing/clear"
+ #ip += "Cookie: nothing/clear </body></html>"
+
+ # return HttpResponse(ip)
+
+ # expose this so we can mention the backend URL on the welcome page
+ def default_env (self):
+ return {
+ 'MANIFOLD_URL':ConfigEngine().manifold_url(),
+ }
+
+ # expose this so we can mention the backend URL on the welcome page
+ #def default_env (self):
+ # config=Config()
+ # return {
+ # 'MANIFOLD_URL':ConfigEngine().manifold_url(),
+ # #'MANIFOLD_URL':config.manifold_url(),
+ # }
+
+ # XXX It's only to test the association of pi and esilva@uff.br
+ if request.session["eppn"] == 'esilva@uff.br':
+ username = 'rezende@ufrj'
+ password = 'fibre2014'
+ print "eppn OK"
+ else:
+ username = request.session["mail"]
+ # this is ugly. We generate a simple password merging mail "fibre" and sn.
+ password = request.session["mail"] + "fibre" + request.session["sn"]
+
+ # If we have " we remove
+ username = username.replace('"','').strip()
+ password = password.replace('"','').strip()
+
+ # pass request within the token, so manifold session key can be attached to the request session.
+ #token = {'username': username, 'password': password, 'request': request}
+ #token = {'username': username, 'password': password}
+
+ # . a ManifoldResult - when something has gone wrong, like e.g. backend is unreachable
+ # . a django User in case of success
+ # . or None if the backend could be reached but the authentication failed
+ print "token CAFe"
+ #print token
+ #auth_result = authenticate(token=token)
+ #auth_result = authenticate(username=username, password=password)
+ auth_result = authenticate(username='rezende@ufrj', password='fibre2014', request=request)
+ print "Auth Result CAFe"
+ print auth_result
+ # high-level errors, like connection refused or the like
+
+ if isinstance (auth_result, ManifoldResult):
+ manifoldresult = auth_result
+ print ManifoldResult
+ print manifoldresult
+ #htm = "<meta http-equiv=\"refresh\" content=\"0; url=https://200.130.15.182/login\" />"
+ htm = "not authenticated"
+ return HttpResponse (htm)
+ # user was authenticated at the backend
+ elif auth_result is not None:
+ user=auth_result
+
+ # Verifying if user is active to logging in
+ if user.is_active:
+ print "LOGGING IN"
+ login(request, user)
+
+ #if request.user.is_authenticated():
+ # env['person'] = username
+ # env['username'] = username
+ #else:
+ # env['person'] = None
+
+ htm = "<meta http-equiv=\"refresh\" content=\"0; url=https://200.130.15.182/login\" />"
+ #return HttpResponseRedirect ('/login-ok')
+ return HttpResponse (htm)
+ else:
+ # Today all CAFe accounts are actived
+ htm = "Your account is not active, please contact the site admin."
+ return HttpResponse (htm)
+
+ # otherwise
+ # Creating the user at manifold, myslice and sfa
+ else:
+ user_params = { 'email': username, 'password': password }
+ user_request = {}
+
+ user_request['auth_type'] = 'managed'
+
+ # XXX Common code, dependency ?
+ from Crypto.PublicKey import RSA
+ private = RSA.generate(1024)
+
+ # Example: private_key = '-----BEGIN RSA PRIVATE KEY-----\nMIIC...'
+ # Example: public_key = 'ssh-rsa AAAAB3...'
+ user_request['private_key'] = private.exportKey()
+ user_request['public_key'] = private.publickey().exportKey(format='OpenSSH')
+
+ splitmail = username.split("@")[0]
+ user = splitmail.replace('"','').strip()
+ hrn = "fibre." + user + str(randint(1,100000))
+
+ user_request['user_hrn'] = hrn
+
+ user_request['first_name'] = request.session['cn']
+ user_request['last_name'] = request.session['sn']
+ user_request['authority_hrn'] = "fibre"
+ user_request['email'] = username
+ user_request['password'] = password
+ user_request['public_key'] = user_request['public_key']
+ user_request['private_key'] = user_request['private_key']
+
+ # Verify in django
+ if PendingUser.objects.filter(email__iexact = user_request['email']):
+ htm = "Erro - User with same email from CAFe exists in Django"
+ # verify in manifol
+ user_query = Query().get('local:user').select('user_id','email')
+ user_details = execute_admin_query(request, user_query)
+ for user_detail in user_details:
+ if user_detail['email'] == user_request['email']:
+ htm = "Erro - user exist in SFA Registry"
+ try:
+ if user_detail['user_hrn'] == user_request['user_hrn']:
+ htm = "Erro - user with the same hrn in SFA Registry"
+ except:
+ continue
+
+
+ #create_pending_user(user_request, user_request, user_detail)
+
+ htm = "Now your CAFe user is associated with a MySlice account - Please login-ok in CAFe again."
+ return HttpResponse(htm)
+ # return HttpResponse(htm)
+
+ # login-ok sets state="Welcome to MySlice" in urls.py
+ def get (self, request, state=None):
+ env = self.default_env()
+ env['username']=the_user(request)
+ env['topmenu_items'] = topmenu_items(None, request)
+ if state: env['state'] = state
+ elif not env['username']: env['state'] = "Please sign in"
+ return HttpResponseRedirect ('/login-ok')
+ #return render_to_response('home-view.html',env, context_instance=RequestContext(request))
+
--- /dev/null
+#!/usr/bin/env python
+
+
+# XXX We need to clean it!!
+from portal.models import PendingUser
+
+#Edelberto from manifoldauth
+import os,sys
+import subprocess
+import shlex
+import getpass
+from hashlib import md5
+import time
+from random import randint
+import crypt
+
+import re
+#from manifold.manifold.core.router import Router
+from manifold.core.query import Query
+from manifoldapi.manifoldapi import execute_admin_query, execute_query
+#from portal.actions import manifold_add_user, manifold_add_account, manifold_update_account
+#from portal.actions import manifold_add_account, manifold_add_reference_user_accounts, sfa_create_user, create_pending_user
+from portal.actions import create_pending_user, create_user
+from manifold.core.query import Query
+# add user to manifold
+
+from unfold.loginrequired import FreeAccessView
+
+from django.views.generic import View
+from django.core.context_processors import csrf
+from django.contrib.auth import authenticate, login, logout
+from django.template import RequestContext
+from django.shortcuts import render_to_response
+
+from manifoldapi.manifoldresult import ManifoldResult, ManifoldCode, ManifoldException
+from ui.topmenu import topmenu_items, the_user
+from myslice.configengine import ConfigEngine
+
+#from django.http import HttpResponse HttpResponseRedirect
+from django.http import HttpResponse
+#from django.http import HttpResponseRedirect
+#from django.template import RequestContext
+from django.contrib.sessions.backends.db import SessionStore
+
+from portal.homeview import HomeView
+
+# View for authenticate the user
+class EdelbertoView (HomeView):
+ def get(self,request):
+ env = self.default_env()
+ env['theme'] = self.theme
+ print "EdelbertoView"
+
+ # XXX We use cookie!
+ # Test cookie support
+ if request.session.test_cookie_worked():
+ #if session.test_cookie_worked():
+ return HttpResponse("Please enable cookies and try again.")
+ #return
+ print "Please enable cookies and try again."
+ else:
+ request.session['cn'] = request.META['Shib-inetOrgPerson-cn']
+ request.session['sn'] = request.META['Shib-inetOrgPerson-sn']
+ request.session['mail'] = request.META['Shib-inetOrgPerson-mail']
+ request.session['eppn'] = request.META['Shib-eduPerson-eduPersonPrincipalName']
+ #request.session['aff'] = request.META['Shib-brEduPerson-brEduAffiliationType']
+ request.session['aff'] = request.META['Shib-eduPerson-eduPersonAffiliation']
+ request.session['shib'] = request.META['Shib-Session-ID']
+
+ if 'mail' in request.session.keys():
+ print "Cookie: OK -> Content: cn:" + request.session["cn"] + " sn " +request.session["sn"] + " mail: " + request.session["mail"] + " eppn: " + request.session["eppn"]
+ #ip += "Cookie: OK -> Content: cn:" + request.session["cn"] + " mail: " + request.session["mail"] + " eppn: " + request.session["eppn"] + "</body></html>"
+ else:
+ print "Cookie: nothing/clear"
+ #ip += "Cookie: nothing/clear </body></html>"
+ # Cookies test finish
+ # return HttpResponse(ip)
+
+ # expose this so we can mention the backend URL on the welcome page
+ def default_env (self):
+ return {
+ 'MANIFOLD_URL':ConfigEngine().manifold_url(),
+ }
+
+
+ # XXX It's only to test the association of pi and esilva@uff.br
+ if request.session["eppn"] == 'esilva@uff.br':
+ username = 'rezende@ufrj'
+ password = 'fibre2014'
+ print "eppn OK"
+ # If the user is not esilva@uff.br, so run the normal authentication
+ else:
+ username = request.session["mail"]
+ # XXX this is ugly. We generate a simple password merging mail "fibre" and sn.
+ password = request.session["mail"] + "fibre" + request.session["sn"]
+
+ # If we have " we remove
+ username = username.replace('"','').strip()
+ password = password.replace('"','').strip()
+
+ # pass request within the token, so manifold session key can be attached to the request session.
+ token = {'username': username, 'password': password, 'request': request}
+
+ # . a ManifoldResult - when something has gone wrong, like e.g. backend is unreachable
+ # . a django User in case of success
+ # . or None if the backend could be reached but the authentication failed
+ auth_result = authenticate(token=token)
+
+ # XXX Error - We need a toke, not send parameters directly!
+ #auth_result = authenticate(username='rezende@ufrj', password='fibre2014', request=request)
+ print "Auth Result CAFe"
+ print type(auth_result)
+ # high-level errors, like connection refused or the like
+
+ if isinstance (auth_result, ManifoldResult):
+ manifoldresult = auth_result
+ #htm = "<meta http-equiv=\"refresh\" content=\"0; url=https://200.130.15.182/login\" />"
+ htm = "not authenticated"
+ return HttpResponse (htm)
+ # user was authenticated at the backend
+ elif auth_result is not None:
+ user=auth_result
+
+ # Verifying if user is active to logging in
+ if user.is_active:
+ print "LOGGING IN"
+ login(request, user)
+
+ #if request.user.is_authenticated():
+ # env['person'] = username
+ # env['username'] = username
+ #else:
+ # env['person'] = None
+
+ htm = "<meta http-equiv=\"refresh\" content=\"0; url=https://200.130.15.182/login\" />"
+ #return HttpResponseRedirect ('/login-ok')
+ return HttpResponse (htm)
+ #return render_to_response(self.template,env, context_instance=RequestContext(request))
+ else:
+ # Today all CAFe accounts are actived
+ htm = "Your account is not active, please contact the site admin."
+ return HttpResponse (htm)
+
+ # otherwise
+ # Creating the user at manifold, myslice and sfa
+ # XXX It's the first of CAFe user in MySlice!
+ else:
+ # Get the username and password
+ user_params = { 'email': username, 'password': password }
+ user_request = {}
+
+ # set the auth_type = managed
+ user_request['auth_type'] = 'managed'
+
+ # XXX Generating the key pairs for CAFe user
+ from Crypto.PublicKey import RSA
+ private = RSA.generate(1024)
+
+ # Example: private_key = '-----BEGIN RSA PRIVATE KEY-----\nMIIC...'
+ # Example: public_key = 'ssh-rsa AAAAB3...'
+ user_request['private_key'] = private.exportKey()
+ user_request['public_key'] = private.publickey().exportKey(format='OpenSSH')
+
+ # Generate a HRN different for all users (plus random int)
+ # Getting the username
+ splitmail = username.split("@")[0]
+ # Getting the organization. The same of authority
+ # testbed name
+ org = username.split('@')[1]
+ o = org.split('.')[-2]
+ user = splitmail.replace('"','').strip()
+ # Finally creating the HRN
+ hrn = "fibre." + o + "." + user + str(randint(1,100000))
+
+ user_request['user_hrn'] = hrn
+
+ # Others fields we can get from CAFe database
+ user_request['first_name'] = request.session['cn']
+ user_request['last_name'] = request.session['sn']
+ # We need to put the user below its authority
+ user_request['authority_hrn'] = "fibre." + o
+ user_request['email'] = username
+ user_request['password'] = password
+ user_request['public_key'] = user_request['public_key']
+ user_request['private_key'] = user_request['private_key']
+
+ # Verify in django if user exist
+ if PendingUser.objects.filter(email__iexact = user_request['email']):
+ htm = "Erro - User with same email from CAFe exists in Django"
+ # verify in manifold and SFA if user exist
+ user_query = Query().get('local:user').select('user_id','email')
+ user_details = execute_admin_query(request, user_query)
+ for user_detail in user_details:
+ if user_detail['email'] == user_request['email']:
+ htm = "Erro - user exist in SFA Registry"
+ try:
+ if user_detail['user_hrn'] == user_request['user_hrn']:
+ htm = "Erro - user with the same hrn in SFA Registry"
+ except:
+ continue
+
+ # first we create a uer with pending flag
+ create_pending_user(user_request, user_request, user_detail)
+ # after we enable this user and put in SFA
+ create_user(user_request, user_request)
+
+ htm = "Now your CAFe user is associated with a MySlice account - Please return to the home and log in CAFe again."
+ return HttpResponse(htm)
--- /dev/null
+import time
+
+from django.contrib.auth.models import User
+
+from manifold.manifoldapi import ManifoldAPI, ManifoldException, ManifoldResult
+from manifold.core.query import Query
+
+# Name my backend 'ManifoldBackend'
+class ManifoldBackend:
+
+ # Create an authentication method
+ # This is called by the standard Django login procedure
+ def authenticate(self, token=None):
+ if not token:
+ return None
+
+ try:
+ username = token['username']
+ password = token['password']
+ request = token['request']
+
+ auth = {'AuthMethod': 'password', 'Username': username, 'AuthString': password}
+ api = ManifoldAPI(auth)
+ sessions_result = api.forward(Query.create('local:session').to_dict())
+ print "result"
+ sessions = sessions_result.ok_value()
+ print "ok"
+ if not sessions:
+ print "GetSession failed", sessions_result.error()
+ return
+ print "first", sessions
+ session = sessions[0]
+
+ # Change to session authentication
+ api.auth = {'AuthMethod': 'session', 'session': session['session']}
+ self.api = api
+
+ # Get account details
+ # the new API would expect Get('local:user') instead
+ persons_result = api.forward(Query.get('local:user').to_dict())
+ persons = persons_result.ok_value()
+ if not persons:
+ print "GetPersons failed",persons_result.error()
+ return
+ person = persons[0]
+ print "PERSON=", person
+
+ request.session['manifold'] = {'auth': api.auth, 'person': person, 'expires': session['expires']}
+ except ManifoldException, e:
+ print "Caught ManifoldException, returning corresponding ManifoldResult"
+ return e.manifold_result
+ except Exception, e:
+ print "E: manifoldbackend", e
+ import traceback
+ traceback.print_exc()
+ return None
+
+ try:
+ # Check if the user exists in Django's local database
+ user = User.objects.get(username=username)
+ except User.DoesNotExist:
+ # Create a user in Django's local database
+ user = User.objects.create_user(username, username, 'passworddoesntmatter')
+ user.first_name = "DUMMY_FIRST_NAME" #person['first_name']
+ user.last_name = "DUMMY LAST NAME" # person['last_name']
+ user.email = person['email']
+ return user
+
+ # Required for your backend to work properly - unchanged in most scenarios
+ def get_user(self, user_id):
+ try:
+ return User.objects.get(pk=user_id)
+ except User.DoesNotExist:
+ return None
+
+
--- /dev/null
+#!/usr/bin/env python
+
+#Edelberto from manifoldauth
+import os,sys
+import subprocess
+import shlex
+import getpass
+from hashlib import md5
+import time
+from random import Random
+import crypt
+
+username = 'teste'
+password = '123'
+
+command = '/var/www/manifold/manifold/bin/adduser.py ' + username + ' ' + password
+ #command = 'ls -la'
+args = shlex.split(command)
+p = subprocess.Popen(args, stdin=subprocess.PIPE).communicate()[0]
+print command
+print args
+print p
--- /dev/null
+from django.http import HttpResponse
+from manifold.core.query import Query
+from manifoldapi.manifoldapi import execute_query,execute_admin_query
+from portal.models import PendingUser, PendingSlice, PendingAuthority
+import json
+
+from django.contrib.auth.models import User
+from django.template.loader import render_to_string
+from django.core.mail import EmailMultiAlternatives
+
+from theme import ThemeView
+
+theme = ThemeView()
+
+# Thierry: moving this right into the code so
+# most people can use myslice without having to install sfa
+# XXX tmp sfa dependency, should be moved to SFA gateway
+#from sfa.util.xrn import Xrn
+
+
+# Get the list of authorities
+
+def authority_get_pis(request, authority_hrn):
+ query = Query.get('authority').filter_by('authority_hrn', '==', authority_hrn).select('pi_users')
+ results = execute_admin_query(request, query)
+ # NOTE: temporarily commented. Because results is giving empty list.
+ # Needs more debugging
+ #if not results:
+ # raise Exception, "Authority not found: %s" % authority_hrn
+ #result, = results
+ #return result['pi_users']
+ return results
+
+def authority_get_pi_emails(request, authority_hrn):
+ pi_users = authority_get_pis(request,authority_hrn)
+ if any(d['pi_users'] == None for d in pi_users):
+ theme.template_name = 'email_default_recipients.txt'
+ default_email = render_to_string(theme.template, request)
+ default_email = default_email.replace('\n', '')
+ return default_email
+ 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')
+ results = execute_admin_query(request, query)
+ return [result['user_email'] for result in results]
+
+def is_pi(wsgi_request, user_hrn, authority_hrn):
+ # XXX could be done in a single query !
+
+ # select pi_authorities from user where user_hrn == "ple.upmc.jordan_auge"
+ query = Query.get('user').filter_by('user_hrn', '==', user_hrn).select('pi_authorities')
+ results = execute_admin_query(wsgi_request, query)
+ if not results:
+ # XXX Warning ?
+ return False
+ result = results[0]
+ user_authority_hrns = result.get('pi_authorities', [])
+ return authority_hrn in user_authority_hrns
+
+# SFA get record
+
+def sfa_get_user(request, user_hrn, pub):
+ query_sfa_user = Query.get('user').filter_by('user_hrn', '==', user_hrn)
+ result_sfa_user = execute_query(request, query_sfa_user)
+ return result_sfa_user
+
+def sfa_update_user(request, user_hrn, user_params):
+ # user_params: keys [public_key]
+ if 'email' in user_params:
+ user_params['user_email'] = user_params['email']
+ query = Query.update('user').filter_by('user_hrn', '==', user_hrn).set(user_params).select('user_hrn')
+ results = execute_query(request,query)
+ return results
+
+def sfa_add_authority(request, authority_params):
+ query = Query.create('authority').set(authority_params).select('authority_hrn')
+ results = execute_query(request, query)
+ print "sfa_add_auth results=",results
+ if not results:
+ raise Exception, "Could not create %s. Already exists ?" % authority_params['hrn']
+ return results
+
+def sfa_add_user_to_slice(request, user_hrn, slice_params):
+# UPDATE myslice:slice SET researcher=['ple.upmc.jordan_auge','ple.inria.thierry_parmentelat','ple.upmc.loic_baron','ple.upmc.ciro_scognamiglio','ple.upmc.mohammed-yasin_rahman','ple.upmc.azerty'] where slice_hrn=='ple.upmc.myslicedemo'
+ query_current_users = Query.get('slice').select('user').filter_by('slice_hrn','==',slice_params['hrn'])
+ results_current_users = execute_query(request, query_current_users)
+ slice_params['researcher'] = slice_params['researcher'] | results_current_users
+ query = Query.update('slice').filter_by('user_hrn', '==', user_hrn).set(slice_params).select('slice_hrn')
+ results = execute_query(request, query)
+# Also possible but not supported yet
+# UPDATE myslice:user SET slice=['ple.upmc.agent','ple.upmc.myslicedemo','ple.upmc.tophat'] where user_hrn=='ple.upmc.azerty'
+ if not results:
+ raise Exception, "Could not create %s. Already exists ?" % slice_params['hrn']
+ return results
+
+# Propose hrn
+
+def manifold_add_user(wsgi_request, request):
+ """Add a Manifold user corresponding to a user request.
+
+ Args:
+ wsgi_request: a WSGIRequest instance
+ request (dict): a dictionary containing the user request built from the
+ form.
+
+ Returns:
+ The user_id of the inserted user.
+
+ Raises:
+ ?
+
+ """
+ USER_CONFIG = '{"firstname": "%(first_name)s", "lastname": "%(last_name)s", "authority": "%(authority_hrn)s"}'
+
+ user_params = {
+ 'email' : request['email'],
+ 'password' : request['password'],
+ 'config' : USER_CONFIG % request,
+ 'status' : 1,
+ }
+
+ query = Query.create('local:user').set(user_params).select('email')
+ results = execute_admin_query(request, query)
+ if not results:
+ raise Exception, "Failed creating manifold user: %s" % user_params['email']
+ result = results[0]
+ return result['email']
+
+def manifold_update_user(request, email, user_params):
+ # user_params: password, config e.g.,
+ query = Query.update('local:user').filter_by('email', '==', email).set(user_params).select('email')
+ results = execute_admin_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 user: %s" % user_params['email']
+ #result, = results
+ return results
+
+def manifold_add_account(request, account_params):
+ query = Query.create('local:account').set(account_params).select(['user', 'platform'])
+ results = execute_admin_query(request,query)
+ if not results:
+ raise Exception, "Failed creating manifold account on platform %s for user: %s" % (account_params['platform'], account_params['user'])
+ result, = results
+ return result['user_id']
+
+def manifold_update_account(request,user_id,account_params):
+ # account_params: config
+ 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, 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
+
+
+#not tested
+def manifold_add_platform(request, platform_params):
+ query = Query.create('local:platform').set(platform_params).select(['user', 'platform'])
+ results = execute_admin_query(request,query)
+ if not results:
+ raise Exception, "Failed creating manifold platform %s for user: %s" % (platform_params['platform'], platform_params['user'])
+ result, = results
+ return result['platform_id']
+
+
+def make_request_user(user):
+ request = {}
+ request['type'] = 'user'
+ request['id'] = user.id
+ request['timestamp'] = user.created # XXX in DB ?
+ request['authority_hrn'] = user.authority_hrn
+ request['first_name'] = user.first_name
+ request['last_name'] = user.last_name
+ request['email'] = user.email
+ request['login'] = user.login
+ request['user_hrn'] = user.user_hrn
+ request['public_key'] = user.public_key
+ request['private_key'] = user.private_key
+ return request
+
+def make_request_slice(slice):
+ request = {}
+ request['type'] = 'slice'
+ request['id'] = slice.id
+ request['user_hrn'] = slice.user_hrn
+ request['timestamp'] = slice.created
+ request['authority_hrn'] = slice.authority_hrn
+ request['slice_name'] = slice.slice_name
+ request['number_of_nodes'] = slice.number_of_nodes
+ request['type_of_nodes'] = slice.type_of_nodes
+ request['purpose'] = slice.purpose
+ return request
+
+def make_request_authority(authority):
+ request = {}
+ request['type'] = 'authority'
+ request['id'] = authority.id
+ request['site_name'] = authority.site_name
+ request['site_latitude'] = authority.site_latitude
+ request['site_longitude'] = authority.site_longitude
+ request['site_url'] = authority.site_url
+ request['site_authority'] = authority.site_authority
+ request['site_abbreviated_name'] = authority.site_abbreviated_name
+ request['address_line1'] = authority.address_line1
+ request['address_line2'] = authority.address_line2
+ request['address_line3'] = authority.address_line3
+ request['address_city'] = authority.address_city
+ request['address_postalcode'] = authority.address_postalcode
+ request['address_state'] = authority.address_state
+ request['address_country'] = authority.address_country
+ request['authority_hrn'] = authority.authority_hrn
+ request['timestamp'] = authority.created
+ return request
+
+def make_requests(pending_users, pending_slices, pending_authorities):
+ requests = []
+ for user in pending_users:
+ requests.append(make_request_user(user))
+ for slice in pending_slices:
+ requests.append(make_request_slice(slice))
+ for authority in pending_authorities:
+ requests.append(make_request_authority(authority))
+ return requests
+
+def get_request_by_id(ids):
+ sorted_ids = { 'user': [], 'slice': [], 'authority': [] }
+ for type__id in ids:
+ type, id = type__id.split('__')
+ sorted_ids[type].append(id)
+
+ if not ids:
+ pending_users = PendingUser.objects.all()
+ pending_slices = PendingSlice.objects.all()
+ pending_authorities = PendingAuthority.objects.all()
+ else:
+ pending_users = PendingUser.objects.filter(id__in=sorted_ids['user']).all()
+ pending_slices = PendingSlice.objects.filter(id__in=sorted_ids['slice']).all()
+ pending_authorities = PendingAuthority.objects.filter(id__in=sorted_ids['authority']).all()
+
+ return make_requests(pending_users, pending_slices, pending_authorities)
+
+def get_requests(authority_hrns=None):
+ print "get_request_by_authority auth_hrns = ", authority_hrns
+ if not authority_hrns:
+ pending_users = PendingUser.objects.all()
+ pending_slices = PendingSlice.objects.all()
+ pending_authorities = PendingAuthority.objects.all()
+ else:
+ pending_users = PendingUser.objects.filter(authority_hrn__in=authority_hrns).all()
+ pending_slices = PendingSlice.objects.filter(authority_hrn__in=authority_hrns).all()
+ pending_authorities = PendingAuthority.objects.filter(authority_hrn__in=authority_hrns).all()
+
+ return make_requests(pending_users, pending_slices, pending_authorities)
+
+# XXX Is it in sync with the form fields ?
+
+def portal_validate_request(wsgi_request, request_ids):
+ status = {}
+
+ if not isinstance(request_ids, list):
+ request_ids = [request_ids]
+
+ requests = get_request_by_id(request_ids)
+ for request in requests:
+ # type, id, timestamp, details, allowed -- MISSING: authority_hrn
+ # CAREFUL about details
+ # user : first name, last name, email, password, keypair
+ # slice : number of nodes, type of nodes, purpose
+
+ request_status = {}
+
+ if request['type'] == 'user':
+
+ try:
+ create_user(wsgi_request, request)
+ request_status['SFA user'] = {'status': True }
+
+ except Exception, e:
+ request_status['SFA user'] = {'status': False, 'description': str(e)}
+
+# user_params = {'status':2}
+# manifold_update_user(request, request['email'], user_params)
+
+ # MANIFOLD user should be added beforehand, during registration
+ #try:
+ # manifold_user_params = { key: request[key] for key in MANIFOLD_USER_KEYS }
+ # # XXX # manifold_add_user(manifold_user_params)
+ # request_status['MySlice user'] = {'status': True }
+ #except Exception, e:
+ # request_status['MySlice user'] = {'status': False, 'description': str(e)}
+
+ # XXX
+ #manifold_account_params = { key: request[key] for key in MANIFOLD_ACCOUNT_KEYS }
+ #manifold_add_account(manifold_account_params)
+ #request_status['MySlice testbed accounts'] = {'status': False }
+
+ elif request['type'] == 'slice':
+ try:
+ create_slice(wsgi_request, request)
+ request_status['SFA slice'] = {'status': True }
+
+ except Exception, e:
+ request_status['SFA slice'] = {'status': False, 'description': str(e)}
+
+ elif request['type'] == 'authority':
+ try:
+ #hrn = "%s.%s" % (request['authority_hrn'], request['site_authority'])
+ hrn = request['site_authority']
+ # XXX tmp sfa dependency
+ from sfa.util.xrn import Xrn
+ urn = Xrn(hrn, request['type']).get_urn()
+
+ sfa_authority_params = {
+ 'hrn' : hrn,
+ 'urn' : urn,
+ 'type' : request['type'],
+ #'pi' : None,
+ 'enabled' : True
+ }
+ print "ADD Authority"
+ sfa_add_authority(wsgi_request, sfa_authority_params)
+ request_status['SFA authority'] = {'status': True }
+
+ except Exception, e:
+ request_status['SFA authority'] = {'status': False, 'description': str(e)}
+
+ # XXX Remove from Pendings in database
+
+ status['%s__%s' % (request['type'], request['id'])] = request_status
+
+ return status
+
+
+def validate_action(request, **kwargs):
+ ids = filter(None, kwargs['id'].split('/'))
+ status = portal_validate_request(request, ids)
+ json_answer = json.dumps(status)
+ return HttpResponse (json_answer, mimetype="application/json")
+
+# Django and ajax
+# http://djangosnippets.org/snippets/942/
+
+
+
+#-------------------------------------------------------------------------------
+# REQUESTS - Slices
+#-------------------------------------------------------------------------------
+
+def create_slice(wsgi_request, request):
+ """
+ Arguments:
+ wsgi_request (~ WSGIRequest) :
+ request (dict) : the slice request in our own dict format
+
+ Raises:
+ Exception
+ """
+ hrn = "%s.%s" % (request['authority_hrn'], request['slice_name'])
+ # XXX tmp sfa dependency
+ from sfa.util.xrn import Xrn
+ urn = Xrn(hrn, request['type']).get_urn()
+
+ # 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()
+
+ # XXX We should create a slice with Manifold terminology
+ slice_params = {
+ 'slice_hrn' : hrn,
+ 'slice_urn' : urn,
+ 'slice_type' : request['type'],
+ 'users' : user_hrns,
+ 'slice_enabled' : True
+ }
+ # ignored in request: id, timestamp, number_of_nodes, type_of_nodes, purpose
+
+ query = Query.create('slice').set(slice_params).select('slice_hrn')
+ results = execute_query(wsgi_request, query)
+ if not results:
+ raise Exception, "Could not create %s. Already exists ?" % slice_params['hrn']
+ return results
+
+def create_pending_slice(wsgi_request, request, email):
+ """
+ """
+
+ # Insert an entry in the PendingSlice table
+ s = PendingSlice(
+ slice_name = request['slice_name'],
+ user_hrn = request['user_hrn'],
+ authority_hrn = request['authority_hrn'],
+ number_of_nodes = request['number_of_nodes'],
+ purpose = request['purpose'],
+ )
+ s.save()
+
+ try:
+ # Send an email: the recipients are the PI of the authority
+ recipients = authority_get_pi_emails(wsgi_request, request['authority_hrn'])
+
+ theme.template_name = 'slice_request_email.txt'
+ text_content = render_to_string(theme.template, request)
+
+ theme.template_name = 'slice_request_email.html'
+ html_content = render_to_string(theme.template, request)
+
+ theme.template_name = 'slice_request_email_subject.txt'
+ subject = render_to_string(theme.template, request)
+ subject = subject.replace('\n', '')
+
+ sender = email
+ msg = EmailMultiAlternatives(subject, text_content, sender, [recipients])
+ print msg
+ msg.attach_alternative(html_content, "text/html")
+ msg.send()
+ except Exception, e:
+ print "Failed to send email, please check the mail templates and the SMTP configuration of your server"
+
+#-------------------------------------------------------------------------------
+# REQUESTS - Users
+#-------------------------------------------------------------------------------
+
+def manifold_add_reference_user_accounts(wsgi_request, request):
+ """When a new user is created, add reference accounts to the reference platform.
+ """
+ # XXX XXX XXX The rest of this function has to be checked XXX XXX XXX
+
+ # Retrieve user information
+ user_query = Query().get('local:user') \
+ .select('user_id', 'config', 'email', 'status') \
+ .filter_by('email', '==', request['email'])
+ user_details = execute_admin_query(wsgi_request, user_query)
+
+ # USER MAIN ACCOUNT != reference
+ #print 'USER MAIN ACCOUNT != reference'
+ list_accounts_query = Query().get('local:account') \
+ .select('user_id', 'platform_id', 'auth_type', 'config') \
+ .filter_by('user_id', '==', user_details[0]['user_id']) \
+ .filter_by('auth_type', '!=', 'reference')
+ list_accounts = execute_admin_query(wsgi_request, list_accounts_query)
+
+ # XXX main_platform is being erased several times ???
+ for account in list_accounts:
+ main_platform_query = Query().get('local:platform') \
+ .select('platform_id', 'platform') \
+ .filter_by('platform_id', '==', account['platform_id'])
+ main_platform = execute_admin_query(wsgi_request, main_platform_query)
+
+ # Add reference accounts on SFA enabled platforms
+ platforms_query = Query().get('local:platform') \
+ .filter_by('disabled', '==', '0') \
+ .filter_by('gateway_type', '==', 'sfa') \
+ .select('platform_id', 'gateway_type')
+ platforms = execute_admin_query(wsgi_request, platforms_query)
+ for platform in platforms:
+ #print "add reference to platform ",platform
+ manifold_account_params = {
+ 'user_id' : user_details[0]['user_id'],
+ 'platform_id' : platform['platform_id'],
+ 'auth_type' : 'reference',
+ 'config' : '{"reference_platform": "' + main_platform[0]['platform'] + '"}',
+ }
+ manifold_add_account(wsgi_request, manifold_account_params)
+
+def sfa_create_user(wsgi_request, request):
+ """
+ Arguments:
+ wsgi_request (~ WSGIRequest) :
+ request (dict) : the user request in our own dict format
+
+ Raises:
+ Exception
+ """
+ from sfa.util.xrn import Xrn
+
+ auth_pi = request.get('pi', None)
+ auth_pi = list([auth_pi]) if auth_pi else list()
+
+ # We create a user request with Manifold terminology
+ sfa_user_params = {
+ 'user_hrn' : request['user_hrn'],
+ 'user_email' : request['email'],
+ 'user_urn' : Xrn(request['user_hrn'], request['type']).get_urn(),
+ 'user_type' : request['type'],
+ 'keys' : request['public_key'],
+ 'user_first_name' : request['first_name'],
+ 'user_last_name' : request['last_name'],
+ 'pi_authorities' : auth_pi,
+ 'user_enabled' : True
+ }
+
+ query = Query.create('user').set(sfa_user_params).select('user_hrn')
+ results = execute_query(wsgi_request, query)
+ if not results:
+ raise Exception, "Could not create %s. Already exists ?" % sfa_user_params['user_hrn']
+ return results
+
+#def ldap_create_user
+
+def create_user(wsgi_request, request):
+
+ # XXX This has to be stored centrally
+ USER_STATUS_ENABLED = 2
+
+ # NOTE : if we were to create a user directly (just like we create slices,
+ # we would have to perform the steps in create_pending_user too
+
+ # Add the user to the SFA registry
+ sfa_create_user(wsgi_request, request)
+
+ # Update Manifold user status
+ manifold_update_user(wsgi_request, request['email'], {'status': USER_STATUS_ENABLED})
+
+ # Add reference accounts for platforms
+ manifold_add_reference_user_accounts(wsgi_request, request)
+
+def create_pending_user(wsgi_request, request, user_detail):
+ """
+ """
+
+ # Insert an entry in the PendingUser table
+ b = PendingUser(
+ first_name = request['first_name'],
+ last_name = request['last_name'],
+ authority_hrn = request['authority_hrn'],
+ email = request['email'],
+ password = request['password'],
+ public_key = request['public_key'],
+ private_key = request['private_key'],
+ user_hrn = request['user_hrn'],
+ pi = '', # XXX Why not None ?
+ )
+ b.save()
+
+ # saves the user to django auth_user table [needed for password reset]
+ user = User.objects.create_user(request['email'], request['email'], request['password'])
+
+ # Creating a manifold user
+ user_id = manifold_add_user(wsgi_request, request)
+
+ # Creating a Manifold account on the MySlice platform
+ # Note the JSON representation of public and private keys already includes quotes
+ account_config = {
+ 'user_hrn' : request['user_hrn'],
+ 'user_public_key' : request['public_key'],
+ }
+ if request['private_key']:
+ account_config['user_private_key'] = request['private_key']
+
+ user_id = user_detail['user_id'] + 1 # the user_id for the newly created user in local:user
+
+ # XXX TODO: Require a myslice platform
+ # ALERT: this will disapear with ROUTERV2 of Manifold
+ # We have to consider the case where several registries can be used
+ # Removed hardcoded platform = 5
+ # This platform == 'myslice' is a TMP FIX !!
+ try:
+ reg_platform_query = Query().get('local:platform') \
+ .filter_by('platform', '==', 'myslice') \
+ .select('platform_id')
+ reg_platform = execute_admin_query(wsgi_request, reg_platform_query)
+
+ registry_platform_id = reg_platform[0]['platform_id']
+ account_params = {
+ 'platform_id' : reg_platform_id, # XXX ALERT !!
+ 'user_id' : user_id,
+ 'auth_type' : request['auth_type'],
+ 'config' : json.dumps(account_config),
+ }
+ manifold_add_account(wsgi_request, account_params)
+ except Exception, e:
+ print "Failed creating manifold account on platform %s for user: %s" % ('myslice', request['email'])
+
+ try:
+ # Send an email: the recipients are the PI of the authority
+ # If No PI is defined for this Authority, send to a default email (different for each theme)
+ recipients = authority_get_pi_emails(wsgi_request, request['authority_hrn'])
+
+ theme.template_name = 'user_request_email.html'
+ html_content = render_to_string(theme.template, request)
+
+ theme.template_name = 'user_request_email.txt'
+ text_content = render_to_string(theme.template, request)
+
+ theme.template_name = 'user_request_email_subject.txt'
+ subject = render_to_string(theme.template, request)
+ subject = subject.replace('\n', '')
+
+ theme.template_name = 'email_default_sender.txt'
+ sender = render_to_string(theme.template, request)
+ sender = sender.replace('\n', '')
+
+ msg = EmailMultiAlternatives(subject, text_content, sender, [recipients])
+ msg.attach_alternative(html_content, "text/html")
+ msg.send()
+ except Exception, e:
+ print "Failed to send email, please check the mail templates and the SMTP configuration of your server"
raise Exception, "Could not create %s. Already exists ?" % sfa_user_params['user_hrn']
return results
+def ldap_create_user(wsgi_request, request, user_detail):
+ """
+ Populating LDAP withuser data - Edelberto 10/03/2014
+ """
+ # import needed modules
+ import ldap
+ import ldap.modlist as modlist
+
+ # Open a connection
+ # XXX We need to create this in settings
+ # ldap.open is deprecated!
+ #l = ldap.open("127.0.0.1")
+ l = ldap.initialize('ldap://127.0.0.1:389')
+
+ # you should set this to ldap.VERSION2 if you're using a v2 directory
+ l.protocol_version = ldap.VERSION3
+
+ # Bind/authenticate with a user with apropriate rights to add objects
+ # XXX Now we set the force rootd but after we need to set this in settings file for could change the dn and password of root
+ l.simple_bind_s("cn=Manager,dc=br","fibre")
+
+ # The dn of our new entry/object
+ #dn="uid=addtest@uff.br,ou=people,o=uff,dc=br"
+
+ # we need to create the dn entry
+ # Receiving an email address, how can we split and mount it in DN format?
+ #mail = "debora@uff.br"
+ mail = request['email']
+ login = mail.split('@')[0]
+ org = mail.split('@')[1]
+ o = org.split('.')[-2]
+ dc = org.split('.')[-1]
+
+ # DN format to authenticate - IMPORTANT!
+ #FIBRE-BR format
+ dn = "uid="+mail+",ou=people,o="+o+",dc="+dc
+
+ # DEBUG
+ print "dn:"+dn
+ print request['password']
+
+ # Creating a unique uidNumber - Necessary for experiments
+ # Was defined to began in 100000
+ unique = int(user_detail['user_id']) + 100000
+ #unique = int(unique)
+ print unique
+
+ # A dict to help build the "body" of the object
+ attrs = {}
+ attrs['objectclass'] = ['person','inetOrgPerson','posixAccount','eduPerson','brPerson','schacPersonalCharacteristics','fibre', 'ldapPublicKey']
+ # XXX Converting all unicodes to string
+ attrs['uid'] = mail.encode('utf-8')
+ attrs['cn'] = request['first_name'].encode('latin1')
+ attrs['sn'] = request['last_name'].encode('latin1')
+ # XXX we need to set a unique uidNumber. How?
+ attrs['uidNumber'] = str(unique)
+ attrs['gidNumber'] = '500'
+ attrs['homeDirectory'] = "/home/"+org+"/"+mail
+ attrs['homeDirectory'] = attrs['homeDirectory'].encode('utf-8')
+ attrs['mail'] = mail.encode('utf-8')
+ attrs['eppn'] = mail.encode('utf8')
+ attrs['userPassword'] = request['password'].encode('utf-8')
+ attrs['sshPublicKey'] = request['public_key'].encode('utf-8')
+ # XXX We really set TRUE for those attributes?
+ #attrs['userEnable'] = 'TRUE'
+ # set FALSE and change after when the user is validated
+ attrs['userEnable'] = 'FALSE'
+ attrs['omfAdmin'] = 'TRUE'
+
+ # Convert our dict to nice syntax for the add-function using modlist-module
+ ldif = modlist.addModlist(attrs)
+
+ # DEBUG
+ print attrs['userPassword']
+ print attrs['cn']
+ print attrs['sn']
+ print attrs['homeDirectory']
+ #print ldif
+
+ # Do the actual synchronous add-operation to the ldapserver
+ l.add_s(dn,ldif)
+
+ # Its nice to the server to disconnect and free resources when done
+ l.unbind_s()
+
+ return ldif
+
+def ldap_modify_user(wsgi_request, request):
+ #Modify entries in an LDAP Directory
+
+ #Synchrounous modify
+ # import needed modules
+ import ldap
+ import ldap.modlist as modlist
+
+ # Open a connection
+ l = ldap.initialize("ldap://localhost:389/")
+
+ # Bind/authenticate with a user with apropriate rights to add objects
+ l.simple_bind_s("cn=Manager,dc=br","fibre")
+
+ # we need to create the dn entry
+ # Receiving an email address, how can we split and mount it in DN format?
+ #mail = "debora@uff.br"
+ mail = request['email']
+ login = mail.split('@')[0]
+ org = mail.split('@')[1]
+ o = org.split('.')[-2]
+ dc = org.split('.')[-1]
+
+ # DN format to authenticate - IMPORTANT!
+ #FIBRE-BR format
+ dn = "uid="+mail+",ou=people,o="+o+",dc="+dc
+
+ # The dn of our existing entry/object
+ #dn="uid=mario@uff.br,ou=people,o=uff,dc=br"
+
+ # Some place-holders for old and new values
+ old = {'userEnable':'FALSE'}
+ new = {'userEnable':'TRUE'}
+
+ # Convert place-holders for modify-operation using modlist-module
+ ldif = modlist.modifyModlist(old,new)
+
+ # Do the actual modification
+ l.modify_s(dn,ldif)
+
+ # Its nice to the server to disconnect and free resources when done
+ l.unbind_s()
+
+ return ldif
+
def create_user(wsgi_request, request):
# XXX This has to be stored centrally
# NOTE : if we were to create a user directly (just like we create slices,
# we would have to perform the steps in create_pending_user too
-
+
+ # Edelberto - I put this more below
# Add the user to the SFA registry
- sfa_create_user(wsgi_request, request)
+ #sfa_create_user(wsgi_request, request)
# Update Manifold user status
manifold_update_user(wsgi_request, request['email'], {'status': USER_STATUS_ENABLED})
# Add reference accounts for platforms
manifold_add_reference_user_accounts(wsgi_request, request)
+
+# Add the user to the SFA registry
+ sfa_create_user(wsgi_request, request)
+ '''
+ # LDAP update user userEnabled = True
+ try:
+ mail = request['email']
+ login = mail.split('@')[0]
+ org = mail.split('@')[1]
+ o = org.split('.')[-2]
+ dc = org.split('.')[-1]
+ # To know if user is a LDAP user - Need to has a 'dc' identifier
+ if dc == 'br' or 'eu':
+ ldap_modify_user(wsgi_request, request)
+ except Exception, e:
+ "LDAP create user failed"
+ '''
def create_pending_user(wsgi_request, request, user_detail):
"""
"""
.filter_by('platform', '==', 'myslice') \
.select('platform_id')
reg_platform = execute_admin_query(wsgi_request, reg_platform_query)
-
reg_platform_id = reg_platform[0]['platform_id']
account_params = {
'platform_id' : reg_platform_id, # XXX ALERT !!
}
manifold_add_account(wsgi_request, account_params)
except Exception, e:
- print "Failed creating manifold account on platform %s for user: %s" % ('myslice', request['email'])
+ print "Failed creating manifold account on platform %s for user: %s" % ('myslice', request['email'])
+
+ # Add user to LDAP userEnabled = False
+ # Not more here. Create before directly to the registrationview.py
+ # After we change userEnable = TRUE when validate the user
try:
# Send an email: the recipients are the PI of the authority
username = request.POST.get('username')
password = request.POST.get('password')
+
+ # LDAP form - If FIBRE, then get the possibilite to authenticate using usernameldap
+ #if self.theme == 'fibre':
+ usernameldap = request.POST.get('usernameldap')
+ token = {'usernameldap': usernameldap, 'username': username ,'password': password, 'request': request}
+ #else:
- # pass request within the token, so manifold session key can be attached to the request session.
- token = {'username': username, 'password': password, 'request': request}
+ # Follow original code
+ ## pass request within the token, so manifold session key can be attached to the request session.
+ #token = {'username': username, 'password': password, 'request': request}
# our authenticate function returns either
# . a ManifoldResult - when something has gone wrong, like e.g. backend is unreachable
from manifold.core.query import Query
from portal.models import PendingUser
-from portal.actions import create_pending_user
+#from portal.actions import create_pending_user
+# Edelberto - LDAP
+from portal.actions import create_pending_user, ldap_create_user
from myslice.theme import ThemeView
user_request['public_key'] = file_content
if not errors:
+ '''
+ try:
+ # verify if is a LDAP
+ mail = user_detail['email']
+ login = mail.split('@')[0]
+ org = mail.split('@')[1]
+ o = org.split('.')[-2]
+ dc = org.split('.')[-1]
+ # To know if user is a LDAP user - Need to has a 'dc' identifier
+ if dc == 'br' or 'eu':
+ # LDAP insert directly - but with userEnable = FALSE
+ ldap_create_user(wsgi_request, user_request, user_detail)
+
+ except Exception, e:
+ print "LDAP: problem em access the LDAP with this credentail"
+ '''
create_pending_user(wsgi_request, user_request, user_detail)
self.template_name = 'user_register_complete.html'
+
return render(wsgi_request, self.template, {'theme': self.theme})
else:
--- /dev/null
+body {
+ background-color:white;
+ color:black;
+ margin:0;
+ padding:0;
+}
+a, a:active, a:focus {
+ outline: 0;
+}
+
+h1 {
+ border-bottom:1px solid #DDDDDD;
+ padding:0 0 5px 0;
+ margin:0 0 15px 0;
+ font-size:18pt;
+}
+h1 img {
+ vertical-align:middle;
+ margin-bottom:4px;
+}
+h2 {
+ font-size:14pt;
+ color:#333333;
+}
+h3 {
+ font-size:13pt;
+ color:#201E62;
+}
+div.wrapper {
+ width:980px;
+ margin:0 auto;
+ position:relative;
+}
+div.container {
+ width:80%;
+ margin:25px auto;
+}
+div.wide {
+ margin:25px auto;
+ padding:0 25px;
+}
+
+span.label {
+ font-size:11pt;
+ color:gray;
+ font-weight:normal;
+ padding:0;
+}
+/***** Notifications *****/
+.warning {
+ border: 1px solid red;
+ margin: 20px 60px;
+ padding: 10px 20px;
+ color: red;
+ background-color: #f2dbdb;
+ text-align: center;
+}
+/* HEADER */
+div#header {
+ height:100px;
+ background-color:white;
+}
+
+div#secondary {
+
+}
+
+div#secondary ul {
+ position:absolute;
+ top:20px;
+ right:0;
+}
+
+div#secondary li {
+ font-size:10pt;
+ float:left;
+ list-style:none;
+ margin-right:30px;
+}
+div#secondary li a {
+ color:black;
+}
+div#secondary li a:hover {
+ color:#270A5A;
+ text-decoration:none;
+}
+div#secondary li:last-child {
+ margin-right:0;
+}
+
+div#navigation {
+ background-color:rgb(30, 88, 111);
+ width:100%;
+ height:40px;
+}
+div#navigation div.wrapper {
+ text-align:center;
+}
+div#navigation ul {
+ margin:0;
+ padding:0;
+ display: inline-block;
+ list-style-type: none;
+ white-space: nowrap;
+}
+
+div#navigation li {
+ color:white;
+ font-family:helvetica, sans-serif;
+ font-size:10pt ;
+ font-weight:normal;
+ line-height:0.8em;
+ letter-spacing:0.6pt;
+ list-style:none;
+ float:left;
+ padding:0;
+ margin:15px 50px 0 0;
+}
+div#navigation li a {
+ color:white;
+}
+div#navigation li a:hover {
+ text-decoration:none;
+ color:#B8B2FF;
+}
+div#navigation li:last-child {
+ margin-right:0;
+}
+
+/* HOME DASHBOARD */
+div#home-dashboard {
+ color:black;
+ margin:0 auto 25px auto;
+}
+div#home-dashboard table {
+/* margin:25px; */
+ width:100% !important;
+}
+div#home-dashboard table td {
+ text-align:center;
+ padding:15px 0;
+ width:33%;
+}
+div#home-dashboard table tr:first-child td {
+ font-size:12pt;
+ font-weight:bold;
+ color:#270A5A;
+}
+div#home-dashboard table tr:last-child td {
+ vertical-align:top;
+ padding:25px 0;
+}
+div#home-dashboard table tr:last-child td.logged-in {
+ /* border-right:1px solid #DDDDDD; */
+ padding:25px;
+}
+div#home-dashboard table tr:last-child td.support {
+ /* border-left:1px solid #DDDDDD; */
+ padding:25px;
+}
+div#home-dashboard table tr:last-child td:first-child {
+}
+div#home-dashboard table tr:last-child td:last-child {
+ border-right:0;
+}
+div#home-dashboard table tr:last-child td.logged-in div {
+ text-align:left;
+ padding:25px 0;
+}
+div#home-dashboard table tr:last-child td.support div {
+ text-align:left;
+ padding:25px 0;
+}
+
+/* Edelberto */
+.bar1 {
+ width: 100%;
+ background: #FCFCFC;
+ border: 1px;
+ border-radius: 4px;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+}
+
+.well {
+ width: 350px !important;
+}
+
+#footer {
+ width: 100%;
+ float: left;
+ background-color: rgb(65, 119, 139);
+ height: 30px;
+ padding: 5px;
+ text-align: center;
+ color: white;
+}
+
+.logo {
+ padding-bottom: 5px;
+}
+
+/* Edelberto end */
+
+div#home-dashboard div.login-widget {
+ padding:20px;
+}
+div#home-dashboard table td.support {
+}
+div#home-dashboard table td.support a {
+}
+div#home-dashboard table td.support a:hover {
+ text-decoration:none;
+}
+
+div#home-dashboard div#manager {
+ display:none;
+}
+
+div#home-dashboard div#home-slice-list {
+ margin:25px 0;
+ padding:0 25px;
+ text-align:left;
+}
+div#home-dashboard div#home-slice-list ul {
+ list-style: none;
+ padding:0;
+ margin:0;
+}
+div#home-dashboard div#home-slice-list li {
+
+}
+
+.login-submit {
+ vertical-align:middle;
+ padding:0;
+}
+.lost-password {
+ font-size:10pt;
+ color:#CCCCCC;
+ text-align:right;
+ padding:0px;
+}
+.lost-password a {
+}
+.login-signup {
+ border-top:1px solid #CCCCCC;
+ text-align:center;
+ margin-top:15px;
+ padding:5px 0 0 0;
+}
+/**/
+
+/* NAV TABS */
+
+.nav.nav-tabs {
+ margin-bottom:25px;
+}
+
+.nav.nav-tabs li.active a {
+
+}
+
+.nav.nav-tabs li a {
+}
+
+.nav.nav-tabs li a:hover {
+}
+
+/**/
+/* WELL */
+div.well {
+}
+/**/
+/* BUTTON */
+.btn.btn-default {
+ font-weight: bold;
+}
+
+.btn.btn-default:hover {
+ font-weight: bold;
+}
+/**/
+/* TABLE */
+table.table {
+ margin:0;
+}
+table.table thead {
+ padding:0;
+}
+table.table tbody {
+ padding:0;
+}
+table.table tr {
+ padding:0;
+}
+table.table td {
+ padding:0;
+}
+/* INSTITUTION */
+div#institution {
+ color:black;
+}
+.form-hint {
+ font-size:11pt;
+ font-style:italic;
+ color:gray;
+}
+
+
+.form-hint {
+ font-size:11pt;
+ font-style:italic;
+ color:gray;
+}
+
+
+
+/* TICKET REQUEST */
+div#ticket-request {
+ color:black;
+}
+.form-hint {
+ font-size:11pt;
+ font-style:italic;
+ color:gray;
+}
+div#ticket-request p {
+ margin:20px 0;
+}
+
+/* SLICE VIEW */
+div#slice-view {
+ margin:0;
+}
+div.list-group-item {
+ border:0;
+ background-color:white;
+ font-weight:bold;
+ padding-left:0;
+}
+a.list-group-item {
+ border:0;
+ background-color:white;
+ padding:3px 0 3px 10px;
+ border-left:2pt white solid;
+}
+a.list-group-item.active, a.list-group-item:hover {
+ border-left:2pt blue solid;
+}
+a.list-group-item p.list-group-item-text {
+ font-size:9pt;
+ font-style:italic;
+}
+
+/* SLICE VIEW sections */
+.slice-sections, .slice-pending {
+ margin:0;
+ padding:0;
+}
+.slice-sections ul, .slice-pending ul {
+ margin:0;
+ padding:0;
+}
+.slice-pending ul {
+ width:400px;
+ margin:0 auto 15px auto;
+}
+.slice-sections li {
+ text-align:left;
+ margin:0;
+ padding:0;
+}
+.slice-pending li {
+ padding-right:15px;
+}
+.slice-sections li a, .slice-pending li a {
+ font-size:14px;
+ color:black;
+ padding:0;
+}
+.slice-sections li.active a, .slice-pending li.active a {
+ color:#201E62;
+ background-color:#EFEFEF;
+ text-decoration:underline;
+ padding:0;
+}
+.slice-sections ul.nav-pills li a:hover, .slice-pending ul.nav-pills li a:hover {
+ text-decoration:underline;
+ background-color:#EFEFEF;
+ color:black;
+}
+.slice-sections ul.nav-pills li.active, .slice-pending ul.nav-pills li.active {
+
+}
+.slice-sections li:first-child, .slice-sections li:first-child a {
+ color:#201E62;
+ font-weight:bold;
+}
+.slice-experiment {
+ text-align:right;
+ padding:0;
+}
+.slice-experiment button {
+ margin:3px 0 0 0;
+ background-color:#CC4125;
+ color:white;
+}
+
+.slice-pending {
+}
+.slice-pending button {
+ font-size:9pt;
+ margin:-2px 0 0 0;
+ padding:3px 5px;
+}
+.slice-pending button.apply {
+}
+.slice-pending button.clear {
+}
--- /dev/null
+/* @override unfold/static/css/plugin.css */
+
+/*-------------------------------- MARKO'S STYLES -----*/
+
+/* GENERAL */
+
+a, a:visited {
+ color: rgb(13, 187, 255) !important;
+ text-decoration: none !important;
+}
+
+a:hover {
+ color: blue !important;
+ text-decoration: none !important;
+}
+
+.container {
+ /*padding: 0 !important;*/
+ padding-top: 60px !important;
+ color: #fff;
+/* background: url(http://new.fit-equipex.fr/images/background.jpg) no-repeat; */
+ background-color: rgb(237, 241, 243);
+ margin: 0;
+ width: 100%;
+ max-width: 100%;
+ min-height: 100%;
+ height: 100%;
+}
+
+.container h1, .container h2 {
+ color: #fff !important;
+}
+
+.navbar-brand {
+ padding: 5px !important;
+}
+
+.nav {
+ padding-top: 30px !important;
+ padding-left: 20px !important;
+}
+
+.navbar-default {
+ background-color: #fff !important;
+}
+
+p.login-status {
+ color: blue !important;
+}
+
+div.plugin-outline-complete,
+div.plugin-outline-body {
+ border: 0px solid;
+ border-radius: 0;
+ border-color: #ccc;
+ -webkit-transition: padding 200ms ease-out;
+ -moz-transition: padding 200ms ease-out;
+ -o-transition: padding 200ms ease-out;
+ transition: padding 0.2s ease-out;
+ padding: 20px;
+ margin: 0;
+}
+/*
+div.plugin-outline-complete:hover,
+div.plugin-outline-body:hover {
+ padding: 80px 80px 120px 80px;
+}
+*/
+a.plugin-tooltip {
+ font-size: 130%;
+ font-style: normal;
+ font-weight: bold;
+ padding: 5px;
+ color: #333;
+ font-family: Ubuntu, Arial, sans-serif;
+ text-transform: uppercase;
+}
+
+a.plugin-tooltip:hover {
+ color: #fff;
+ text-decoration: none;
+}
+
+
+
+/* LIST VIEW */
+div.well-lg {
+ background-color: rgba(168, 32, 202, 0.5) !important;
+}
+div.onelab-title {
+ background-color: #3A5FCD !important;
+ /*background-color: rgba(168, 32, 202, 0.5) !important;*/
+}
+div.well {
+ /*background-color: rgba(0, 0, 0, 0.5) !important;*/
+ background-color: #fff !important;
+ color: rgb(37, 37, 37) !important;
+}
+h2.well.well-lg {
+ border-radius:0;
+ border: 0;
+ font-family: Ubuntu, arial, sans-serif;
+ /* text-transform: ; */
+ font-weight: normal;
+ font-size: 40px;
+ /* color: #30196d; */
+ color: white;
+ margin-bottom: 0px;
+ margin-top: 0;
+ padding: 40px;
+ opacity: 1;
+ text-align: center;
+ background-color: #30196d;
+}
+
+#complete-resources {
+/* background-color: #92f79e !important; */
+ background-color: #B8B2FF !important;
+}
+
+#complete-filters {
+/* background-color: #4af25d; */
+ background-color: #add7ff;
+}
+
+#complete-users {
+/* background-color: #ff7394 !important; */
+ background-color: #add7ff !important;
+}
+/*
+#complete-measurements {
+ background-color: !important;
+}
+*/
+#complete-pending {
+/* background-color: #add7ff !important; */
+ background-color: #B8B2FF !important;
+
+}
+
+#complete-customize-resources {
+ background-color: #efdfdf;
+}
+
+#complete-msgs-pre {
+ background-color: #ccc;
+}
+
+#complete-resources,
+#complete-filters,
+#complete-users,
+#complete-measurements,
+#complete-pending,
+#complete-customize-resources,
+#complete-msgs-pre {
+ opacity: 1;
+ text-align: center;
+ color: #333;
+}
+
+#complete-resources:hover,
+#complete-filters:hover,
+#complete-users:hover,
+#complete-measurements:hover,
+#complete-pending:hover,
+#complete-customize-resources:hover,
+#complete-msgs-pre:hover {
+ opacity: 1;
+}
+
+.nav.nav-tabs {
+ font-family: Ubuntu, Arial, sans-serif;
+ border: 0 !important;
+ border-bottom: 3px solid #fff !important;
+ margin-bottom: 40px;
+}
+
+.nav.nav-tabs li.active a {
+ color: #572bc9;
+ border-left: 0px solid #572bc9;
+ border-top: 0px solid #572bc9;
+ border-right: 0px solid #572bc9;
+}
+
+.nav.nav-tabs li a {
+ color: #333;
+ border: 0 !important;
+ margin-right: 5px;
+}
+
+.nav.nav-tabs li a:hover {
+ color: #333;
+ background: #572bc9;
+ color: #fff;
+ border: 0 !important;
+}
+
+
+
+/* if window enlarged wider than background picture */
+body {
+ background: rgb(237, 241, 243) !important;
+ /*background: black !important;*/
+}
+
+/* TOPMENU.CSS */
+
+/* Thierry : turning this off
+body {
+ *//* background: #30196d !important; *//*
+ background: black !important;
+ padding-top: 60px;
+ padding-bottom: 0px;
+}
+Thierry */
+
+/* Thierry : turning this off
+div.topmenu {
+ padding-top: 0px;
+ font-family: Ubuntu, Arial, sans-serif;
+ font-weight: bold;
+ background: #fff;
+ -webkit-box-shadow: 0px 10px 10px rgba(50, 50, 50, 0.44);
+ -moz-box-shadow: 0px 10px 10px rgba(50, 50, 50, 0.44);
+ box-shadow: 0px 10px 10px rgba(50, 50, 50, 0.44);
+}
+Thierry */
+
+/* Thierry : turning this off
+.navbar-nav li a,
+.navbar-nav li.other a {
+ padding-top: 25px;
+ padding-bottom: 20px;
+}
+Thierry */
+
+.navbar-nav li a:hover {
+ color: #572bc9 !important;
+}
+
+.navbar-nav li.active a {
+ background: #eee !important;
+}
+
+/* Thierry : turning this off
+ul.logged-in {
+ padding-top: 25px;
+}
+Thierry */
+button.logged-in {
+ font-size: 1em;
+ font-weight: bold;
+ margin-left: 5px;
+ margin-top: -5px;
+ background: #572bc9;
+ border: 2px solid #572bc9;
+ color: #eee;
+ padding: 5px 15px;
+ border-radius:5px;
+}
+
+button.logged-in:hover {
+ /* background: #4af25d; */
+ background: #ff7394;
+ border: 2px solid #ff7394;
+ color: #333;
+}
+li.username {
+ margin-bottom: 10px;
+ font-size: 0.8em;
+ text-transform: none;
+ font-weight: normal;
+ color: #999;
+}
+
+
+/* BOOTSTRAP */
+
+
+ul.pagination li a {
+ /* background: ; */
+ color: #572bc9;
+ font-family: Ubuntu, Arial, sans-serif;
+}
+
+ul.pagination li.active a {
+ background: #572bc9;
+ border: 1px solid #572bc9;
+}
+
+.btn.btn-default {
+ background: #572bc9;
+ color: #ccc;
+ font-family: Ubuntu, Arial, sans-serif;
+ font-weight: bold;
+ border: 0px;
+}
+
+.btn.btn-default:hover {
+ /* background: #4af25d; */
+ background: #ff7394;
+ color: #333;
+ font-family: Ubuntu, Arial, sans-serif;
+ font-weight: bold;
+ border: 0px;
+}
+
+input {
+ border-radius: 3px;
+ border: none;
+ border: 1px solid #ccc;
+}
+
+
+div.dataTables_length label,
+div.dataTables_filter label,
+div.dataTables_info {
+ font-family: Ubuntu, Arial, sans-serif !important;
+}
+
+
+
+
+/* QUERYTABLE */
+
+div.QueryTable table.dataTable th {
+ font: bold 12px/22px Ubuntu, Arial, sans-serif;
+ color: #333 !important;
+ border-right: 0px solid #333 !important;
+ border-bottom: 0px solid #C1DAD7 !important;
+ border-top: 0px solid #C1DAD7 !important;
+ letter-spacing: 1px;
+ text-transform: uppercase;
+ text-align: left;
+ padding: 8px 12px 4px 20px;
+ vertical-align:middle;
+ background: url('../img/tablesort-header.png') no-repeat !important;
+}
+
+div.QueryTable table.dataTable td, div.QueryTable table.dataTable textarea, div.QueryTable table.dataTable input [type="text"] {
+ font: normal 12px Ubuntu, Arial, Helvetica, sans-serif;
+ border-right: 0px solid #fff !important;
+ border-bottom: 1px solid #fff !important;
+}
+
+div.QueryTable table.dataTable thead {
+ background: url('../img/tablesort-header.png') repeat-x !important;
+ background-color: #caebea;
+}
+
+div.QueryTable table.dataTable tfoot {
+ background: url('../img/tablesort-header.png') repeat-x !important;
+ /* background-color: # !important; */
+}
+
+
+/* QUERY EDITOR */
+
+table.query-editor {
+ margin: 40px auto !important;
+ clear: both;
+ /* width: 80%;*/
+ width: 100% !important;
+ font-family: Ubuntu;
+}
+
+.query-editor-spacer,
+.plugin.QueryUpdater,
+/* Thierry : turning this off
+.plugin.Tabs
+Thierry */
+{
+ margin-top: 60px !important;
+}
+
+table.query-editor td {
+ padding: 5px 5px !important;
+ font: normal 12px Ubuntu, Arial, sans-serif !important;
+}
+
+
+
+/* DASHBOARD */
+
+#ms-dashboard-profile,
+#ms-dashboard-testbeds,
+#ms-dashboard-slices {
+ -webkit-transition: all 50ms ease-out;
+ -moz-transition: all 50ms ease-out;
+ -o-transition: all 50ms ease-out;
+ transition: all 0.05s ease-out;
+ padding-top: 140px;
+ padding-bottom: 60px;
+ margin-top: 60px;
+ color: #fff;
+ font-family: Ubuntu, Arial, sans-serif;
+ text-align: center;
+
+}
+
+#ms-dashboard-profile:hover,
+#ms-dashboard-testbeds:hover,
+#ms-dashboard-slices:hover {
+ margin-top: 65px;
+}
+
+#ms-dashboard-profile {
+ background: url("../img/icon_users_color.png") top center no-repeat;
+}
+
+#ms-dashboard-testbeds {
+ background: url("../img/icon_testbed_color.png") top center no-repeat;
+}
+
+#ms-dashboard-slices {
+ background: url("../img/icon_slices_color.png") top center no-repeat;
+}
+
+.ms-dashboard-content ul {
+ list-style-type: none !important;
+ padding-left: 0;
+ text-align: center !important;
+}
+
+.ms-dashboard-content {
+ padding: 0 !important;
+}
+
+.ms-dashboard-content a {
+ color: #ff7394 !important;
+/* color: #ff0099 !important; */
+}
+
+.ms-dashboard-content a:hover {
+ color: white !important;
+}
+.ms-dashboard-caption h2 {
+ font-family: Ubuntu, Arial, sans-serif;
+ border-bottom: 0 !important;
+ text-transform: uppercase;
+}
+
+#ms-dashboard-profile>div.ms-dashboard-caption {
+ background: no-repeat url(#) !important;
+ padding-left: 0 !important;
+}
+
+#ms-dashboard-testbeds>div.ms-dashboard-caption {
+ background: no-repeat url(#) !important;
+ padding-left: 0 !important;
+}
+
+#ms-dashboard-slices>div.ms-dashboard-caption {
+ background: no-repeat url(#) !important;
+ padding-left: 0 !important;
+}
+
<body ng-app="ManifoldApp">
{% block container %}
{% block topmenu %}
- {% widget "_widget-topmenu.html" %}
+ {% widget "__widget-topmenu.html" %}
{% endblock topmenu %}
{% include 'messages-transient.html' %}
{% block base_content %}
--- /dev/null
+<div class="well">
+ {% if state %}
+ <span class="help-block">{{ state }}</span>
+ {% endif %}
+ <form action="/login/" method="post" role="form">
+ {% csrf_token %}
+ {% if next %}
+ <input type="hidden" name="next" value="{{ next }}" />
+ {% endif %}
+ <div class="form-group">
+ <label for="fed"></label>
+ <input type="radio" name="base" value="br" checked>
+ <img src="{{ STATIC_URL }}img/fibre/br.png" alt="Brazil" height="32" width="40" />
+ <input type="radio" name="base" value="eu">
+ <img src="{{ STATIC_URL }}img/fibre/eu.png" alt="Europe Union" height="32" width="32" />
+ <input type="radio" name="base" value="local">Local User
+ </div>
+ <div class="form-group">
+ <label for="username">Username </label>
+ <input type="email" class="form-control" name="username" placeholder="Enter Email / username">
+ </div>
+ <div class="form-group">
+ <label for="password">Password</label>
+ <input type="password" class="form-control" name="password" placeholder="Password">
+ </div>
+ <div class="login-submit">
+ <input class="btn btn-default" type="submit" value="Sign In" />
+ <span class="lost-password"> | <a href="/portal/pass_reset/">Can't access your account?</a></span>
+ </div>
+ <div class="login-signup">
+ <a href="/portal/register">Try</a>, <a href="/portal/register">Sign Up</a> or <a href="/portal/join">Join</a>
+ </div>
+ </form>
+</div>
--- /dev/null
+<div class="well">
+ {% if state %}
+ <span class="help-block">{{ state }}</span>
+ {% endif %}
+ <form action="/login/" method="post" role="form">
+ {% csrf_token %}
+ {% if next %}
+ <input type="hidden" name="next" value="{{ next }}" />
+ {% endif %}
+ <div class="form-group">
+ <label for="username">Email address / Username</label>
+ <input type="email" class="form-control" name="username" placeholder="Enter Email / username">
+ </div>
+ <div class="form-group">
+ <label for="password">Password</label>
+ <input type="password" class="form-control" name="password" placeholder="Password">
+ </div>
+ <div class="login-submit">
+ <input class="btn btn-default" type="submit" value="Sign In" />
+ <span class="lost-password"> | <a href="/portal/pass_reset/">Can't access your account?</a></span>
+ </div>
+ <div class="login-signup">
+ <a href="/portal/register">Try</a>, <a href="/portal/register">Sign Up</a> or <a href="/portal/join">Join</a>
+ </div>
+ </form>
+</div>
--- /dev/null
+<div class="well login-widget">
+ {% if state %}
+ <span class="help-block">{{ state }}</span>
+ {% endif %}
+ <form action="/login/" method="post" role="form">
+ {% csrf_token %}
+ {% if next %}
+ <input type="hidden" name="next" value="{{ next }}" />
+ {% endif %}
+ <div class="form-group">
+ <label for="usernameldap">LDAP User</label>
+ <input type="email" class="form-control" name="usernameldap" placeholder="LDAP user">
+ </div>
+ <div class="form-group">
+ <label for="password">Password</label>
+ <input type="password" class="form-control" name="password" placeholder="Password">
+ </div>
+ <div class="login-submit">
+ <input class="btn btn-default" type="submit" value="Sign In" />
+ <span class="lost-password"> | <a href="/portal/pass_reset/">Can't access your account?</a></span>
+ </div>
+ <div class="login-signup">
+ <a href="/portal/register">Try</a> or <a href="/portal/register">Sign Up</a>
+ </div>
+ </form>
+</div>
--- /dev/null
+<div class="well">
+ {% if state %}
+ <span class="help-block">{{ state }}</span>
+ {% endif %}
+ <form action="/login/" method="post" role="form">
+ {% csrf_token %}
+ {% if next %}
+ <input type="hidden" name="next" value="{{ next }}" />
+ {% endif %}
+ <div class="form-group">
+ <label for="username">Email address / Username</label>
+ <input type="email" class="form-control" name="username" placeholder="Enter Email / username">
+ </div>
+ <div class="form-group">
+ <label for="password">Password</label>
+ <input type="password" class="form-control" name="password" placeholder="Password">
+ </div>
+ <div class="login-submit">
+ <input class="btn btn-default" type="submit" value="Sign In" />
+ <span class="lost-password"> | <a href="/portal/pass_reset/">Can't access your account?</a></span>
+ </div>
+ <div class="login-signup">
+ <a href="/portal/register">Try</a>, <a href="/portal/register">Sign Up</a> or <a href="/portal/join">Join</a>
+ </div>
+ </form>
+</div>
--- /dev/null
+<div class="well login-widget">
+ {% if state %}
+ <span class="help-block">{{ state }}</span>
+ {% endif %}
+ <form action="/login/" method="post" role="form">
+ {% csrf_token %}
+ {% if next %}
+ <input type="hidden" name="next" value="{{ next }}" />
+ {% endif %}
+ <div class="form-group">
+ <label for="username">Email address / Username</label>
+ <input type="email" class="form-control" name="username" placeholder="Enter Email / username">
+ </div>
+ <div class="form-group">
+ <label for="password">Password</label>
+ <input type="password" class="form-control" name="password" placeholder="Password">
+ </div>
+ <div class="login-submit">
+ <input class="btn btn-default" type="submit" value="Sign In" />
+ <span class="lost-password"> | <a href="/portal/pass_reset/">Can't access your account?</a></span>
+ </div>
+ <div class="login-signup">
+ <a href="/portal/register">Try</a> or <a href="/portal/register">Sign Up</a>
+ </div>
+ </form>
+</div>
--- /dev/null
+
+<div id="header">
+ <div class="wrapper">
+ <div class="logo">
+ <a href="/"><img src="{{ STATIC_URL }}img/fibre-logo.gif" alt="FIBRE - Future Internet Testbeds Experimentation Between Brazil and Europe" width="150px" height="75px" /></a>
+ </div>
+
+ <div id="secondary">
+ <ul>
+ <li>News</li>
+ <li><a href="/portal/about">About</a></li>
+ <li><a target="_blank" href="http://www.fibre-ict.eu/">Public Website</a></li>
+ <li><a target="_blank" href="#">Intranet</a></li>
+ </ul>
+ </div>
+ </div>
+
+ {% if username %}
+ <div id="navigation">
+ <div class="wrapper">
+ <ul>
+ <li id="nav-account"><a href="/portal/account/">{{ username }}</a></li>
+ <li>|</li>
+ <li id="nav-institution" class=""><a href="/portal/institution">INSTITUTION</a></li>
+ <li class="slices">
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
+ SLICES <span class="caret"></span>
+ </a>
+
+ <div class="dropdown-menu">
+ <ul>
+ <li><a href="/portal/slice_request/">Request Slice</a></li>
+ <li><a href="/slice/ple.upmc.agent3/">ple.upmc.agent3</a></li>
+ <li><a href="/slice/ple.upmc.agent/">ple.upmc.agent</a></li>
+ <li><a href="/slice/ple.upmc.myslicedemo/">ple.upmc.myslicedemo</a></li>
+ <li><a href="/slice/ple.upmc.slicestat/">ple.upmc.slicestat</a></li>
+ <li><a href="/slice/ple.upmc.agent2/">ple.upmc.agent2</a></li>
+ </ul>
+ </div>
+ </li>
+ <li id="nav-request"><a href="/portal/validate">REQUESTS</a></li>
+ <li id="nav-support"><a href="/portal/support/">SUPPORT</a></li>
+ <li>|</li>
+ <li id="nav-logout" style="margin-top: 10px;"><a id="logout" style="cursor:pointer;" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> LOGOUT</a></li>
+ </ul>
+ </div>
+ </div>
+ {% else %}
+ <div id="navigation">
+ <div class="wrapper"></div>
+ </div>
+ {% endif %}
+</div>
+<script>
+ $(document).ready(function() {
+ $('li.slices').mouseenter(function() {
+ $('div#menu-slice-list').fadeIn(100);
+ });
+ $('div#menu-slice-list').mouseleave(function(e) {
+ if (!$('li.slices').is(":hover")) {
+ $(this).fadeOut(100);
+ }
+ });
+ // var slices = localStorage.getItem('slices');
+ // if (slices.length == 0) {
+ // $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
+ // var items = [];
+ // localStorage.setItem('slices', data[0].slice);
+ // });
+ // }
+ // $.each(slices, function( key, val ) {
+ // items.push( "<li><a href=\"/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></li>" );
+ // });
+ // $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
+ });
+</script>
--- /dev/null
+{% extends "layout.html" %}
+
+{% block content %}
+<div class="row">
+ <h1><img src="{{ STATIC_URL }}icons/slices-xs.png" alt="About MySlice" /> About</h1>
+</div>
+
+<div class="row">
+ <h3>A ready-made and easily customisable user interface for your testbed.</h3>
+
+ <p>
+ MySlice is an ambitious project aiming to support researchers throughout the lifecycle of experiments that can run on a variety
+ of testbeds spanning different administrative domains and networking technologies. Its basic principle is to bring together
+ available resources with useful information (characteristics, performance, network measurements).
+ </p>
+ <p>
+ MySlice inititiave started in Janury 2011 by offering annotation services for the first ederated experimental resources. Today,
+ MySlice has taken a big step toward becoming a tand-alone web framework, which will present all available resources from testbeds
+ across the world, interconnected through the Slice-based Facility Architecture (SFA) and annotated by the TopHat measurement system.
+ </p>
+ <p>
+ Our framework is built with standard programming tools (php and javascript for the front-end and python for the back-end)
+ and has a modular structure based on the concept of plugins for implementing different core functionalities (query editing,
+ data display, and resource allocation).
+ </p>
+ <p>
+ The goal is to enable developers with expertise on different testbed technologies and different experimental
+ practices to work in parallel for optimizing the tools presented to the users allowing them for a wide range of choices
+ according to their own requirements. Opening in this way the development of web-based user tools for experimentation and
+ sharing effort and information can increase significantly the chances for the achievement of our challenging objective.
+ </p>
+ <p>
+ You can access the code at git.myslice.info. 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>.
+ </p>
+ <p>
+ Go to the <a href ="http://myslice.info">MySlice web site</a> or the <a href ="http://www.fibre-ict.eu">FIBRE public web site</a>
+ </p>
+</div>
+
+{% endblock %}
--- /dev/null
+{# This is required by insert_above #}{% insert_handler %}<!DOCTYPE html>
+<html lang="en"><head>
+<title>FIBRE - {{ section }}</title>
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<link rel="shortcut icon" href="/static/img/myslice-icon.png">
+{# This is where insert_str will end up #}{% media_container prelude %}
+{% include 'messages-transient-header.html' %}
+<script type="text/javascript"> {# raw js code - use {% insert prelude_js %} ... {% endinsert %} #} {% container prelude_js %}</script>
+<script src="{{ STATIC_URL }}js/jquery.dataTables.min.js"></script>
+<script src="{{ STATIC_URL }}js/bootstrap.datatables.js"></script>
+<script src="{{ STATIC_URL }}js/myslice-ui.js"></script>
+<style type="text/css">{# In case we need to add raw css code #}{% container prelude_css %}</style>
+{{ header_prelude }}
+{% block head %} {% endblock head %}
+{# let's add these ones no matter what #}
+{% insert_str prelude "js/jquery.min.js" %}
+{% insert_str prelude "js/jquery.html5storage.min.js" %}
+{% insert_str prelude "js/messages-runtime.js" %}
+{% insert_str prelude "js/class.js" %}
+{% insert_str prelude "js/plugin-helper.js" %}
+{% insert_str prelude "js/mustache.js" %}
+{% insert_str prelude "js/plugin.js" %}
+{% insert_str prelude "js/manifold.js" %}
+{% insert_str prelude "css/manifold.css" %}
+{% insert_str prelude "css/plugin.css" %}
+<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/{{ theme }}.css">
+</head>
+<body>
+{% block container %}
+ {% block topmenu %}
+ {% include theme|add:"__widget-topmenu.html" %}
+ {% endblock topmenu %}
+ {% include 'messages-transient.html' %}
+ {% block base_content %}
+ {% endblock %}
+{% endblock container %}
+</body>
+</html>
--- /dev/null
+{% extends "layout.html" %}
+
+{% block head %}
+{{ wizard.form.media }}
+{% endblock %}
+
+{% block content %}
+<div class="row">
+ <div class="col-md-12">
+ <h1><img src="{{ STATIC_URL }}img/icon_support_small.png" alt="Open a Ticket" /> FIBRE Support</h1>
+ </div>
+</div>
+<div class="row">
+ <div class="col-md-12"> </div>
+</div>
+<div class="row">
+ <div class="col-md-12">
+ <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.
+ </p>
+ </div>
+</div>
+
+<div class="row">
+ <div class="col-md-2"></div>
+ <div class="col-md-8">
+ <form role="form" method="post">
+ {% csrf_token %}
+ {% for field in form %}
+ <div class="form-group">
+ <label for="{{ field.html_name }}" class="control-label">{{ field.label }}</label>
+ {{ field.errors }} {{ field }}
+ </div>
+ {% endfor %}
+ <button type="submit" class="btn btn-default">Create Ticket</button>
+ </form>
+ </div>
+</div>
+{% endblock %}
+
--- /dev/null
+{% extends "layout.html" %}
+
+{% block content %}
+<div class="row">
+ <div class="col-md-12">
+ <h1><img src="{{ STATIC_URL }}img/icon_support_small.png" alt="Open a Ticket" /> FIBRE Portal Documentation</h1>
+ </div>
+</div>
+<div class="row">
+ <div class="col-md-12">
+
+</div>
+</div>
+{% endblock %}
+
--- /dev/null
+{% extends "layout.html" %}
+
+{% block content %}
+<div class="row" id="home-dashboard">
+ <ul class="nav nav-tabs">
+ <li class="active"><a class="home-tab" data-panel="user" href="#">USER</a></li>
+ <li><a class="home-tab" data-panel="manager" href="#">MANAGER</a></li>
+ </ul>
+ <div class="home-panel" id="user">
+ <table>
+ <tr>
+ <td>ACCOUNT</td>
+ <td>SLICES</td>
+ <td>SUPPORT</td>
+ </tr>
+ <tr>
+ <td><a href="/portal/account/"><img src="{{ STATIC_URL }}img/icon_user_color.png" alt="" /></a></td>
+ <td><a href="#"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a></td>
+ <td><a href="/portal/support"><img src="{{ STATIC_URL }}img/icon_support.png" alt="" /></a></td>
+ </tr>
+ <tr>
+ {% if person %}
+ <td class="logged-in">
+ <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
+ <div>
+ {% if person.last_name %}
+ {{person.first_name}} {{person.last_name}}<br />
+ {% endif %}
+ <span class="label">Email:</span> <a href='/portal/account/'>{{person.email}}</a>
+ </div>
+ {% else %}
+ <td>
+ {# include 'fibre__widget-login-user.html' #}
+ {# include 'fibre__widget-login-ldap-user.html' #}
+ {% include 'fibre__widget-login-fed-manager.html' %}
+ <a href="/cafe"><img src="{{ STATIC_URL }}img/fibre/cafe.jpg" alt="CAFe authentication" /></a>
+ {% endif %}
+ </td>
+ <td>
+ {% if person %}
+ <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Request a Slice</button>
+ <div id="home-slice-list"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
+ {% else %}
+ {% endif %}
+ </td>
+ <td class="support">
+ <button id="ticketbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create Ticket</button>
+ <div>
+ <a href="/portal/contact">Contact</a> <br />
+ <a href="/portal/support/documentation">Documentation</a>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div class="home-panel" id="manager">
+ <table>
+ <tr>
+ <td>INSTITUTION</td>
+ <td>SLICES</td>
+ <td>REQUESTS</td>
+ </tr>
+ <tr>
+ <td><a href="/portal/institution"><img src="{{ STATIC_URL }}img/icon_authority_color.png" alt="" /></a></td>
+ <td><a href="/portal/institution#slices"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a></td>
+ <td><a href="/portal/validate"><img src="{{ STATIC_URL }}img/icon_testbed_color.png" alt="" /></a></td>
+ </tr>
+ </table>
+ <table>
+ <tr class="bar1">
+ {% if person %}
+ <td class="logged-in">
+ <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
+ {% else %}
+ <td>
+ {# include 'fibre__widget-login-user.html' #}
+ {# include 'fibre__widget-login-ldap-user.html' #}
+ {% include 'fibre__widget-login-fed-manager.html' %}
+ {% endif %}
+ </td>
+ <td>
+ {% if person %}
+ <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create a Slice</button>
+ {% endif %}
+ </td>
+ <td class="support">
+ {% if person %}
+ <button id="validaterequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-ok"></span> Validate Requests</button>
+ {% endif %}
+ </td>
+ </tr>
+ </table>
+ </div>
+</div>
+<div id="footer">
+ FIBRE - Future Internet testbeds / experimentation between BRazil and Europe
+</div>
+<script>
+ $(document).ready(function() {
+ $('a.home-tab').click(function() {
+ $('ul.nav-tabs li').removeClass('active');
+ $(this).parent().addClass('active');
+ $('div.home-panel').hide();
+ $('div#'+$(this).data('panel')).show();
+ });
+ $('button#validaterequestbtn').click(function() {
+ window.location="/portal/validate/";
+ });
+ $('button#ticketbtn').click(function() {
+ window.location="/portal/contact/";
+ });
+ $('button#slicerequestbtn').click(function() {
+ window.location="/portal/slice_request/";
+ });
+
+ {% if person %}
+ $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
+ var items = [];
+ $.each( data[0].slices, function(i, val) {
+ items.push( "<li><a href=\"/slice/"+val+"\">" + val + "</a></li>" );
+ });
+
+ $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
+
+ });
+ {% endif %}
+ });
+</script>
+{% endblock %}
--- /dev/null
+{% extends "layout.html" %}
+{% block head %}
+<script type="text/javascript" src="{{STATIC_URL}}/js/institution.js"></script>
+{% endblock head %}
+{% block content %}
+<div class="row">
+ <h1><img src="{{ STATIC_URL }}img/icon_authority_color_small.png" alt="" /> Institution: {{user_details.parent_authority}}</h1>
+</div>
+<div class="row" id="institution">
+ <ul class="nav nav-tabs">
+ <li class="active" id="authority-tab"><a class="home-tab" data-panel="institution" href="#">INFO</a></li>
+ <li id="users-tab"><a class="home-tab" data-panel="users" href="#">USERS</a></li>
+ <li id="slices-tab"><a class="home-tab" data-panel="slices" href="#">SLICES</a></li>
+ </ul>
+ <div class="home-panel" id="institution">
+ <div id="authority-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Authority" /></div>
+ <div id="authority-tab-loaded" style="display:none;">
+ <div id="authority-data" style="float:left; width:50%;"></div>
+ </div>
+ </div>
+ <div class="home-panel" id="users" style="display:none;">
+ <div id="user-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
+ <div id="user-tab-loaded" style="display:none;">
+ <table id="user-tab">
+ <tr>
+ <th>+/-</th>
+ <th>Email</th>
+ <th>user_hrn</th>
+ <th>First name</th>
+ <th>Last name</th>
+ <th>Enabled</th>
+ </tr>
+ </table>
+ <br>
+ <button id="deleteusers" type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete Users</button>
+ </div>
+ </div>
+ <div class="home-panel" id="slices" style="display:none;">
+ <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> create slice</button>
+ <div id="slice-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
+ <div id="slice-tab-loaded" style="display:none;">
+ <table id="slice-tab">
+ <tr>
+ <th>+/-</th>
+ <th>slice_hrn</th>
+ <th>users</th>
+ <th>url</th>
+ <th>nodes</th>
+ <th>expiration</th>
+ </tr>
+ </table>
+ <br>
+ <div>
+ <button id="renewslices" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> Renew Slices</button>
+ <button id="deleteslices" type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete Slices</button>
+ </div>
+ </div>
+ </div>
+</div>
+<script>
+ $(document).ready(function() {
+ {% if person %}
+ {% if user_details.parent_authority %}
+ $.post("/rest/authority/",{'filters':{'authority_hrn':'{{user_details.parent_authority}}'}}, function( data ) {
+ var authority_data = [];
+ var onelab_data = [];
+ /* 'city','enabled','legal','longitude','onelab_membership','address','parent_authority','slice','user','country',
+ 'tech','abbreviated_name','url','postcode','description','scientific','authority_hrn','latitude','name' */
+ $.each( data, function( key, val ) {
+ authority_row = "<img src='{{ STATIC_URL }}img/institutions/{{user_details.parent_authority}}.gif' alt='' /><br>";
+ authority_row += "<br>";
+ authority_row += "<b>authority:</b> "+val.authority_hrn+"<br>";
+ authority_row += "<br>";
+ /*
+ authority_row += "<b>"+val.name+"</b><br>";
+ authority_row += "<br>";
+ authority_row += "<b>Address:</b> "+val.address+"<br>";
+ authority_row += "<b>City:</b> "+val.postcode+" "+val.city+"<br>";
+ authority_row += "<br>";
+ authority_row += "<b>Country:</b> "+val.country+"<br>";
+ authority_row += "<br>";
+ authority_row += "<br>";
+ authority_row += "<h2>Contacts</h2>";
+ authority_row += "<b>Legal:</b> ";
+ */
+ /*
+
+ TODO: find a way to express JSON correctly given the constrains: CSV / JSON
+
+ legal = jQuery.parseJSON(val.legal);
+ if($.isArray(legal)){
+ $.each(legal, function(k,v){
+ authority_row += k+" "+v+"<br>";
+ });
+ }else{
+ authority_row += val.legal+"<br>";
+ //}
+ authority_row += "<br>";
+ authority_row += "<b>Scientific:</b> ";
+ scientific = jQuery.parseJSON(val.scientific);
+ if($.isArray(scientific)){
+ $.each(scientific, function(v){
+ authority_row += v+", ";
+ });
+ }else{
+
+ authority_row += val.scientific+"<br>";
+ }
+ onelab_membership = "<b>Status: </b>"+val.onelab_membership;
+ onelab_data.push(onelab_membership);
+ */
+ authority_data.push(authority_row);
+ });
+ $("div#authority-data").html(authority_data.join( "" ));
+ $("div#onelab-data").html(onelab_data.join( "" ));
+ $("div#authority-tab-loaded").css("display","block");
+ $("div#authority-tab-loading").css("display","none");
+ });
+
+ $.post("/rest/slice/",{'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
+ var list_slices = [];
+ var table_slices = [];
+ /* "slice_hrn", "slice_description", "slice_type", "parent_authority", "created", "nodes", "slice_url", "slice_last_updated", "user", "slice_urn", "slice_expires" */
+ $.each( data, function( key, val ) {
+ list_slices.push( "<li><a href=\"portal/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></li>" );
+ if(val.nodes=="undefined" || val.nodes==null){
+ nodes_length=0;
+ }else{
+ nodes_length=val.nodes.length;
+ }
+
+ if(val.user=="undefined" || val.user==null){
+ user_length=0;
+ }else{
+ user_length=val.user.length;
+ }
+
+ if(val.slice_url=="undefined" || val.slice_url==null){
+ slice_url="";
+ }else{
+ slice_url="<a href='"+val.slice_url+"' target='_blank'>"+val.slice_url+"</a>";
+ }
+
+ slice_row = "<tr id='"+val.slice_hrn+"'>";
+ slice_row += "<td><input type='checkbox' class='slice' id='"+val.slice_hrn+"'></td>";
+ slice_row += "<td><a href=\"/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></td>";
+ slice_row += "<td>"+user_length+"</td>";
+ slice_row += "<td>"+slice_url+"</td>";
+ slice_row += "<td>"+nodes_length+"</td>";
+ slice_row += "<td>"+val.slice_expires+"</td>";
+ slice_row += "</tr>";
+ table_slices.push(slice_row);
+
+ });
+
+ /* $("div#slice-list").html($( "<ul/>", { html: list_slices.join( "" ) })); */
+ $("table#slice-tab tr:last").after(table_slices.join( "" ));
+ $("div#slice-tab-loaded").css("display","block");
+ $("div#slice-tab-loading").css("display","none");
+ });
+
+ $.post("/rest/user/",{'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
+ var list_users = [];
+ var table_users = [];
+ /* Available fields
+ user_gid, user_enabled, slices, pi_authorities, keys, parent_authority, user_first_name,
+ user_urn, user_last_name, user_phone, user_hrn, user_email, user_type
+ */
+ $.each( data, function( key, val ) {
+ list_users.push( "<li><a href=\"portal/user/"+val.user_email+"\">" + val.user_email + "</a></li>" );
+
+ user_row = "<tr id='"+val.user_hrn+"'>";
+ user_row += "<td><input type='checkbox' class='user' id='"+val.user_hrn+"'></td>";
+ user_row += "<td>"+val.user_email+"</td>";
+ user_row += "<td>"+val.user_hrn+"</td>";
+ user_row += "<td>"+val.user_first_name+"</td>";
+ user_row += "<td>"+val.user_last_name+"</td>";
+ user_row += "<td>"+val.user_enabled+"</td>";
+ user_row += "</tr>";
+ table_users.push(user_row);
+
+ });
+ $("table#user-tab tr:last").after(table_users.join( "" ));
+ $("div#user-tab-loaded").css("display","block");
+ $("div#user-tab-loading").css("display","none");
+ });
+ {% endif %}
+ {% endif %}
+ });
+</script>
+{% endblock %}
--- /dev/null
+{% extends "layout.html" %}
+
+{% block content %}
+
+<div class="row">
+ <div class="col-md-12">
+ <h1><img src="{{ STATIC_URL }}img/icon_user_small.png" alt="User Registration" /> FIBRE Experimenter Registration</h1>
+ </div>
+</div>
+<div class="row">
+ <div class="col-md-12">
+ <h3>For First Line Support please <a href="/portal/contact" >Contact Support</a></h3>
+ </div>
+</div>
+{% if errors %}
+<ul>
+ {% for error in errors %}
+ <li>{{ error }}</li>
+ {% endfor %}
+</ul>
+{% endif %}
+
+<div class="row">
+ <div class="col-md-2"></div>
+ <div class="col-md-8">
+ <form class="cmxform form-horizontal" id="registrationForm" method="post" enctype="multipart/form-data" role="form">
+ {% csrf_token %}
+ <div class="form-group">
+ <label for="firstname" class="control-label">First Name</label>
+ <input type="text" name="firstname" class="form-control" minlength="2" value="{{ firstname }}" placeholder="First Name" required />
+ </div>
+ <div class="form-group">
+ <label for="lastname" class="control-label">Last Name</label>
+ <input type="text" name="lastname" size="25" class="form-control" minlength="2" value="{{ lastname }}" placeholder="Last Name" required />
+ </div>
+ <div class="form-group">
+ <label for="authority_hrn" class="control-label">Authority</label>
+ <input id="authority_hrn" name="authority_hrn" class="form-control" value="{{ authority_hrn }}" required>
+ <p class="help-block">An authority responsible for vetting your account</p>
+ </div>
+
+ <!-- LOGIN
+ TODO: Login should be suggested from user email or first/last name, and
+ checked for existence. In addition, the full HRN should be shown to the
+ user.
+ <div class="form-group">
+ <label for="login" class="col-xs-2 control-label">Login</label>
+ <div class="col-xs-4">
+ <input type="text" name="login" size="25" class="form-control" minlength="2" value="{{ login }}" placeholder="Login" required />
+ </div>
+ <div class="col-xs-6"><p class="form-hint">Enter your login</p></div>
+ </div>
+ -->
+
+ <div class="form-group">
+ <label for="email" class="control-label">Email</label>
+ <input type="email" name="email" size="25" class="form-control" value="{{ email }}" required/>
+ </div>
+ <div class="form-group">
+ <label for="password" class="control-label">Password</label>
+ <input type="password" id="password" name="password" class="form-control" minlength="4" value="{{ password }}" required/>
+ </div>
+ <div class="form-group">
+ <label for="password" class="control-label">Confirm Password</label>
+ <input type="password" id="confirmpassword" name="confirmpassword" minlength="4" class="form-control" value="" placeholder="Confirm Password" required/>
+ </div>
+ <div class="form-group">
+ <label for="question" class="control-label">My Keys</label>
+ <select name="question" class="form-control" id="key-policy" required>
+ <option value="generate">Generate key pairs for me </option>
+ <option value="upload">Upload my public key </option>
+ </select>
+ <p class="help-block">Genkey: Account Delegation Automatic (Recommended)</p>
+ </div>
+ <div class="form-group" style="display:none;" id="upload_key">
+ <label for="file" class="control-label">Upload public key</label>
+ <input type="file" name="user_public_key" class="form-control" id="user_public_key" required>
+ <br />
+ <div class="alert alert-danger" id="pkey_del_msg">
+ Once your account is validated, you will have to delegate your credentials manually using SFA [Advanced users only]
+ </div>
+ <p class="help-block">Account Delegation: Manual (Advanced Users)</p>
+ </div>
+ <div class="form-group" id="register">
+ <button class="submit btn btn-default" type="submit">Register</button>
+ </div>
+ </form>
+</div>
+<script>
+jQuery(document).ready(function(){
+ var availableTags = [
+ {% if authorities %}
+ {% for authority in authorities %}
+ {% if authority.name %}
+ {value:"{{ authority.authority_hrn }}",label:"{{authority.name}}"},
+ {% else %}
+ {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
+ {% endif %}
+ {% endfor %}
+ {% else %}
+ {value:"",label:"No authority found !!!"}
+ {% endif %}
+ ];
+ jQuery( "#authority_hrn" ).autocomplete({
+ source: availableTags,
+ minLength: 0,
+ change: function (event, ui) {
+ if(!ui.item){
+ //http://api.jqueryui.com/autocomplete/#event-change -
+ // The item selected from the menu, if any. Otherwise the property is null
+ //so clear the item for force selection
+ jQuery("#authority_hrn").val("");
+ }
+ }
+ //select: function( event, ui ) {console.log(jQuery(this))}
+ });
+});
+</script>
+{% endblock %}
+
--- /dev/null
+{% extends "layout.html" %}
+
+{% block content %}
+
+ <h1>Slice request Received !</h1>
+
+We will process your request and get back to you as soon as possible.
+{% endblock %}
+
--- /dev/null
+{% extends "layout-unfold1.html" %}
+
+{% block unfold_main %}
+
+ <h1>Slice created !</h1>
+
+As you are a PI of the site, you slice has directly been created.
+
+{% endblock %}
+
--- /dev/null
+{% extends "layout_wide.html" %}
+
+{% block head %}
+<!-- <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC1RUj824JAiHRVqgc2CSIg4CpKHhh84Lw&sensor=false"></script> -->
+<script src="{{ STATIC_URL }}js/onelab_slice-resource-view.js"></script>
+<script>
+ //myslice.slice = "{{ slice }}";
+</script>
+{% endblock %}
+
+{% block content %}
+ <div class="col-md-2">
+ <div id="select-platform" class="list-group">
+ </div>
+
+ <!-- <ul class="list-group">
+ <li class="list-group-item">Filter: CPU</li>
+ <li class="list-group-item">Filter: Interface</li>
+ <li class="list-group-item">...</li>
+ <li class="list-group-item">...</li>
+ <li class="list-group-item">...</li>
+ </ul> -->
+
+ </div>
+ <div class="col-md-10" style="height:100%;">
+ <div class="row">
+ {% include theme|add:"_widget-slice-sections.html" %}
+ </div>
+ <!-- <div class="row slice-pending">
+ <ul class="nav nav-pills">
+ <li><a href="">Unreserved</a></li>
+ <li><a href="">Reserved</a></li>
+ <li><a href="">Pending<span class="badge" id="badge-pending" style="display:none;"></span></a></li>
+ <li>
+ <button type="button" class="btn btn-primary apply" id="ApplyPendind">Apply</button>
+ <button type="button" class="btn btn-default clear">Clear</button>
+ </li>
+ <li>
+ <div id="loading" style="display:none;"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading" /></div>
+ </li>
+ </ul>
+ </div> -->
+ <div class="row">
+ {% if msg %}
+ <div class="col-md-12"><p class="alert-success">{{ msg }}</p></div>
+ {% endif %}
+ </div>
+ <div class="row">
+ <ul class="nav nav-pills nav-resources">
+ <li class="active"><a data-panel="resources" href="#">Resources</a></li>
+ <li id="GoogleMap"><a data-panel="map" href="#">Map</a></li>
+ <li><a data-panel="pending" href="#">Pending</a></li>
+ <li><a href="#"></a></li>
+ </ul>
+ </div>
+ <div class="row" style="height:100%;">
+ <div id="resources" class="panel">
+ {{list_resources}}
+ <!-- <table cellpadding="0" cellspacing="0" border="0" class="table" id="objectList"></table> -->
+ </div>
+ <div id="map" class="panel" style="height:370px;display:none;">
+ {{map_resources}}
+ </div>
+ <div id="pending" class="panel" style="height:370px;display:none;">
+ {{pending_resources}}
+ </div>
+ </div>
+ </div>
+{% endblock %}
--- /dev/null
+{% extends "layout_wide.html" %}
+
+
+{% block content %}
+ <div class="col-md-2">
+ <div id="select-platform" class="list-group">
+ </div>
+
+ <ul class="list-group">
+ <li class="list-group-item">Authority:<b> {{user_details.parent_authority}}</b>
+ <!--<select id="auth_list">
+ <option value="ple.upmc">UPMC</option>
+ <option value="ple.inria">INRIA</option>
+ <option value="ple.nitos">NITOS</option>
+ <option value="ple.iminds">iMinds</option>
+ </select> -->
+ </li>
+ <li class="list-group-item">Filter: slice</li>
+ <li class="list-group-item">...</li>
+ <li class="list-group-item">...</li>
+ <li class="list-group-item">...</li>
+ </ul>
+
+ </div>
+ <div class="col-md-10">
+ <div class="row">
+ {% include theme|add:"_widget-slice-sections.html" %}
+ </div>
+ <div class="row slice-pending">
+ <ul class="nav nav-pills">
+ <li><a href="">All users</a></li>
+ <li><a href="">Users in Slice</a></li>
+ <li><a href="">Pending<span class="badge">42</span></a></li>
+ <li>
+ <button type="button" class="btn btn-primary apply">Apply</button>
+ <button type="button" class="btn btn-default clear">Clear</button>
+ </li>
+ </ul>
+ </div>
+ <div class="row">
+ <ul class="nav nav-tabs">
+ <li class="active"><a href="#">Users</a></li>
+ <li><a href="#"></a></li>
+ <li><a href="#"></a></li>
+ </ul>
+ </div>
+ <div id="user-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Useres" /></div>
+ <div id="user-tab-loaded" style="display:none;">
+ <table id="user-tab">
+ <tr>
+ <th>+/-</th>
+ <th>Email</th>
+ <th>user_hrn</th>
+ <th>Enabled</th>
+ </tr>
+ </table>
+ </div>
+<script>
+ $(document).ready(function() {
+ //var selectedValue = $( "#auth_list option:selected" ).val();
+ //console.log(selectedValue);
+ //console.log("Name of the authority: " + "{{user_details.parent_authority}}");
+ //$("#auth_list").change(function(){
+ //selectedValue = $(this).find(":selected").val();
+ //console.log("the value you selected: " + selectedValue);
+ $.post("/rest/user/",{'filters':{'parent_authority': "{{user_details.parent_authority}}"}}, function( data ) {
+ var list_users = [];
+ var table_users = [];
+ /* Available fields
+ user_gid, user_enabled, slices, pi_authorities, keys, parent_authority, user_first_name,
+ user_urn, user_last_name, user_phone, user_hrn, user_email, user_type
+ */
+ $.each( data, function( key, val ) {
+ list_users.push( "<li><a href=\"portal/user/"+val.user_email+"\">" + val.user_email + "</a></li>" );
+ user_row = "<tr>";
+ // checking the box for the users that belong to the selected slice
+ var flag_checkbox = 0;
+ for(var data in val.slices) {
+ var element = val.slices[data];
+ if (element == "{{slice}}"){
+ //console.log("the slice is: "+ element);
+ flag_checkbox = 1;
+ user_row += "<td><input type='checkbox' checked='True'></td>";
+ }
+ }
+ if(flag_checkbox != 1){
+ user_row += "<td><input type='checkbox'></td>";
+ }
+ user_row += "<td>"+val.user_email+"</td>";
+ user_row += "<td>"+val.user_hrn+"</td>";
+ user_row += "<td>"+val.user_enabled+"</td>";
+ user_row += "</tr>";
+ table_users.push(user_row);
+
+ });
+ $("table#user-tab tr:last").after(table_users.join( "" ));
+ $("div#user-tab-loaded").css("display","block");
+ $("div#user-tab-loading").css("display","none");
+ });
+ // });
+ });
+</script>
+
+{% endblock %}
--- /dev/null
+{% extends "layout_wide.html" %}
+
+{% block head %}
+
+{% endblock %}
+
+{% block content %}
+
+<div class="wrapper">
+ <div class="row">
+ <div class="col-md-12">
+ {% include theme|add:"_widget-slice-sections.html" %}
+ </div>
+ </div>
+</div>
+<div class="container-fluid tab-content">
+ <div class="tab-pane active row" id="info">...</div>
+ <div class="tab-pane row" id="testbeds">...</div>
+ <div class="tab-pane row" id="resources">...</div>
+ <div class="tab-pane row" id="users">...</div>
+ <div class="tab-pane row" id="statistics">...</div>
+ <div class="tab-pane row" id="measurements">...</div>
+ <div class="tab-pane row" id="experiment">...</div>
+</div>
+{% endblock %}
--- /dev/null
+{% extends "layout.html" %}
+
+{% block content %}
+ <div class="row">
+ <h1><img src="{{ STATIC_URL }}img/icon_support_small.png" alt="Request a Slice" /> Portal Support</h1>
+ </div>
+
+
+ <div class="row">
+ <h2>Report a Bug</h2>
+ <p>If you have found a bug or having difficulties accesing some features or found some anomalies, please report it using our ticketing system.</p>
+ <button id="ticketbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create Ticket</button>
+ <h3>Unresolved Tickets</h3>
+ </div>
+
+ <div class="row">
+ <table class="mytable table table-bordered table-hover">
+ <tr>
+ <th>Ticket No</th>
+ <th>Reported By</th>
+ <th>Description</th>
+ <th>Status</th>
+ </tr>
+ <tr>
+ <td>1</td>
+ <td>yasin.upmc@gmail.com</td>
+ <td> Slice_request page is not working </td>
+ <td> Unresolved</td>
+ </tr>
+ <tr>
+ <td>2</td>
+ <td>azerty@lip6.fr</td>
+ <td>Unable to Register</td>
+ <td>Unresolved</td>
+ </tr>
+
+ </table>
+ </div>
+
+
+
+ <div class="row">
+
+ <h2><a href="/portal/support/documentation">FAQ</a></h2>
+ <h2>Contact Us</h2>
+
+ <h3>Mailing List</h3>
+ <p>You can subscribe to our mailing list by sending a request to: <b>support</b> AT <b>myslice</b> DOT <b>info</b></p>
+ <p>Also you can adress any issues in the same email address.</p>
+
+ </div>
+
+<script>
+ $(document).ready(function() {
+ $('li#nav-support').addClass("active");
+ $('button#ticketbtn').click(function() {
+ window.location="/portal/contact/";
+ });
+ });
+</script>
+
+
+{% endblock %}
+
--- /dev/null
+{% extends "layout_wide.html" %}
+
+{% block content %}
+ <div class="col-md-2"></div>
+ <div class="col-md-10">
+ <div class="row">
+ {% include theme|add:"_widget-slice-sections.html" %}
+ </div>
+ <div class="row">
+ <ul class="nav nav-tabs">
+ <li class="active"><a href="#">Testbeds</a></li>
+ <li><a href="#"></a></li>
+ <li><a href="#"></a></li>
+ </ul>
+ </div>
+ <table cellpadding="0" cellspacing="0" border="0" class="table" id="testbedList"></table>
+ </div>
+{% endblock %}
\ No newline at end of file
--- /dev/null
+{% extends "layout.html" %}
+
+{% block content %}
+
+<div class="row">
+ <h1><img src="{{ STATIC_URL }}img/icon_user_small.png" alt="User Registration" /> Experimenter Registration</h1>
+</div>
+<div class="row">
+ <h3>User registration complete !</h3>
+ <p>
+ You will receive an email with further instructions.
+ </p>
+ </div>
+
+{% endblock %}
--- /dev/null
+<ul class="nav nav-tabs nav-sliceview">
+ <li {% if section != "resources" %}class="active"{% endif %}>
+ <a href="#info"><img src="{{ STATIC_URL }}icons/slices-xs.png" alt="About MySlice" /> {{ slice }}</a>
+ </li>
+ <li><a href="#testbeds">Testbeds</a></li>
+ <li {% if section == "resources" %}class="active"{% endif %}><a class="link" href="/resources/{{ slice }}">Resources</a></li>
+ <li><a href="#users">Users</a></li>
+ <li><a href="#experiment">Statistics</a></li>
+ <li><a href="#experiment">Measurements</a></li>
+ <li><a href="#experiment" data-toggle="tab">Experiment</a></li>
+</ul>
+<script>
+$(document).ready(function() {
+ $('.nav-sliceview a').click(function (e) {
+ if ($(this).hasClass('link')) return;
+ e.preventDefault();
+ $(this).tab('show');
+ var id = $(this).attr('href').substr(1);
+ $("#" + id).load('/' + id + '/{{ slice }}/');
+ });
+ $('div#info').load('/info/{{ slice }}/');
+});
+</script>
--- /dev/null
+{% extends "layout_wide.html" %}
+
+{% block head %}
+<script src="{{ STATIC_URL }}js/onelab_slice-resource-view.js"></script>
+{% endblock %}
+
+{% block content %}
+ <div class="col-md-2">
+ <div id="select-platform" class="list-group">
+ </div>
+
+ <ul class="list-group">
+ <li class="list-group-item">Filter: CPU</li>
+ <li class="list-group-item">Filter: Interface</li>
+ <li class="list-group-item">...</li>
+ <li class="list-group-item">...</li>
+ <li class="list-group-item">...</li>
+ </ul>
+
+ </div>
+ <div class="col-md-10">
+ <div class="row">
+ {% include theme|add:"_widget-slice-sections.html" %}
+ </div>
+ <div class="row slice-pending">
+ <ul class="nav nav-pills">
+ <li><a href="">Unreserved</a></li>
+ <li><a href="">Reserved</a></li>
+ <li><a href="">Pending<span class="badge">42</span></a></li>
+ <li>
+ <button type="button" class="btn btn-primary apply">Apply</button>
+ <button type="button" class="btn btn-default clear">Clear</button>
+ </li>
+ </ul>
+ </div>
+ <div class="row">
+ <ul class="nav nav-tabs">
+ <li class="active"><a href="#">Resources</a></li>
+ <li><a href="#"></a></li>
+ <li><a href="#"></a></li>
+ </ul>
+ </div>
+ <table cellpadding="0" cellspacing="0" border="0" class="table" id="objectList"></table>
+ </div>
+{% endblock %}
\ No newline at end of file
--- /dev/null
+{% extends "layout_wide.html" %}
+
+
+{% block content %}
+ <div class="col-md-2">
+ <div id="select-platform" class="list-group">
+ </div>
+
+ <ul class="list-group">
+ <li class="list-group-item">Filter: authority</li>
+ <li class="list-group-item">Filter: slice</li>
+ <li class="list-group-item">...</li>
+ <li class="list-group-item">...</li>
+ <li class="list-group-item">...</li>
+ </ul>
+
+ </div>
+ <div class="col-md-10">
+ <div class="row">
+ {% include theme|add:"_widget-slice-sections.html" %}
+ </div>
+ <div class="row slice-pending">
+ <ul class="nav nav-pills">
+ <li><a href="">All users</a></li>
+ <li><a href="">Users in Slice</a></li>
+ <li><a href="">Pending<span class="badge">42</span></a></li>
+ <li>
+ <button type="button" class="btn btn-primary apply">Apply</button>
+ <button type="button" class="btn btn-default clear">Clear</button>
+ </li>
+ </ul>
+ </div>
+ <div class="row">
+ <ul class="nav nav-tabs">
+ <li class="active"><a href="#">Users</a></li>
+ <li><a href="#"></a></li>
+ <li><a href="#"></a></li>
+ </ul>
+ </div>
+ <div id="user-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Useres" /></div>
+ <div id="user-tab-loaded" style="display:none;">
+ <table id="user-tab">
+ <tr>
+ <th>+/-</th>
+ <th>Email</th>
+ <th>user_hrn</th>
+ <th>Enabled</th>
+ </tr>
+ </table>
+ </div>
+<script>
+ $(document).ready(function() {
+ $.post("/rest/user/",{'filters':{'parent_authority':'ple.upmc'}}, function( data ) {
+ var list_users = [];
+ var table_users = [];
+ /*
+ "enabled", "keys", "parent_authority", "user_first_name", "user_last_name", "user_phone", "user_hrn", "slice", "user_email"
+ */
+ $.each( data, function( key, val ) {
+ list_users.push( "<li><a href=\"portal/user/"+val.user_email+"\">" + val.user_email + "</a></li>" );
+ user_row = "<tr>";
+ // checking the box for the users that belong to the selected slice
+ var flag_checkbox = 0;
+ for(var data in val.slice) {
+ var element = val.slice[data];
+ console.log("element");
+ console.log(element);
+ for(var key in element) {
+ var value = element[key];
+ if (value == 'ple.upmc.myslicedemo'){
+ console.log("found!!");
+ flag_checkbox = 1;
+ user_row += "<td><input type='checkbox' checked='True'></td>";
+ }
+
+ }
+ }
+ if(flag_checkbox != 1){
+ user_row += "<td><input type='checkbox'></td>";
+ }
+ user_row += "<td>"+val.user_email+"</td>";
+ user_row += "<td>"+val.user_hrn+"</td>";
+ user_row += "<td>"+val.enabled+"</td>";
+ user_row += "</tr>";
+ table_users.push(user_row);
+
+ });
+ $("table#user-tab tr:last").after(table_users.join( "" ));
+ $("div#user-tab-loaded").css("display","block");
+ $("div#user-tab-loading").css("display","none");
+ });
+ });
+</script>
+
+{% endblock %}
--- /dev/null
+{% extends "layout_wide.html" %}
+
+{% block content %}
+ <div class="col-md-2"></div>
+ <div class="col-md-10">
+ <div class="row">
+ {% include theme|add:"_widget-slice-sections.html" %}
+ </div>
+ </div>
+
+ <div class="col-md-2"></div>
+ <div class="col-md-10">
+ <br>
+ <br>
+ <div id="slice-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
+ <div id="slice-tab-loaded" style="display:none;">
+ <table id="slice-tab">
+ </table>
+ </div>
+ </div>
+
+<script>
+ $(document).ready(function() {
+ $.post("/rest/slice/",{'filters':{'slice_hrn':'{{slice}}'}}, function( data ) {
+ var table_slices = [];
+ /* "slice_hrn", "slice_description", "slice_type", "parent_authority", "created", "nodes", "slice_url", "slice_last_updated", "user", "slice_urn", "slice_expires" */
+ $.each( data, function( key, val ) {
+ if(val.nodes=="undefined" || val.nodes==null){
+ nodes_length=0;
+ }else{
+ nodes_length=val.nodes.length;
+ }
+
+ if(val.user=="undefined" || val.user==null){
+ user_length=0;
+ }else{
+ user_length=val.user.length;
+ }
+
+ if(val.slice_url=="undefined" || val.slice_url==null){
+ slice_url="";
+ }else{
+ slice_url="<a href='"+val.slice_url+"' target='_blank'>"+val.slice_url+"</a>";
+ }
+
+ slice_row = "<tr><td><b>Description:</b></td><td>"+val.slice_description+"</td></tr>";
+ slice_row += "<tr><td><b>url:</b></td><td><a href='"+val.slice_url+" target='_blank'>"+val.slice_url+"</a></td></tr>";
+ slice_row += "<tr><td><b>users:</b></td><td>"+user_length+"</td></tr>";
+ slice_row += "<tr><td><b>resources:</b></td><td>"+nodes_length+"</td></tr>";
+ slice_row += "<tr><td><b>created:</b></td><td>"+val.created+"</td></tr>";
+ slice_row += "<tr><td><b>last update:</b></td><td>"+val.last_updated+"</td></tr>";
+ slice_row += "<tr><td><b>expires:</b></td><td>"+val.slice_expires+"</td></tr>";
+ table_slices.push(slice_row);
+ });
+ $("table#slice-tab").html(table_slices.join( "" ));
+ $("div#slice-tab-loaded").css("display","block");
+ $("div#slice-tab-loading").css("display","none");
+ });
+ });
+</script>
+{% endblock %}
--- /dev/null
+<div class="col-md-8 slice-sections">
+ <ul class="nav nav-pills nav-justified">
+ <li {% if section == 'slice' %}class="active"{% endif %}><a href="/slice/{{ slice }}/">{{ slice }}</a></li>
+ <li {% if section == 'testbeds' %}class="active"{% endif %}><a href="/testbeds/{{ slice }}/">Testbeds</a></li>
+ <li {% if section == 'resources' %}class="active"{% endif %}><a href="/resources/{{ slice }}/">Resources</a></li>
+ <li {% if section == 'users' %}class="active"{% endif %}><a href="/users/{{ slice }}/">Users</a></li>
+ <li><a href="">Statistics</a></li>
+ <li><a href="">Measurements</a></li>
+ </ul>
+</div>
+<div class="col-md-4 slice-experiment">
+ <a href="/portal/experiment"><button type="button" class="btn btn-default">Experiment</button></a>
+</div>
--- /dev/null
+<div class="well">
+ {% if state %}
+ <span class="help-block">{{ state }}</span>
+ {% endif %}
+ <form action="/login/" method="post" role="form">
+ {% csrf_token %}
+ {% if next %}
+ <input type="hidden" name="next" value="{{ next }}" />
+ {% endif %}
+ <div class="form-group">
+ <label for="username">Email address / Username</label>
+ <input type="email" class="form-control" name="username" placeholder="Enter Email / username">
+ </div>
+ <div class="form-group">
+ <label for="password">Password</label>
+ <input type="password" class="form-control" name="password" placeholder="Password">
+ </div>
+ <div class="login-submit">
+ <input class="btn btn-default" type="submit" value="Sign In" />
+ <span class="lost-password"> | <a href="/portal/pass_reset/">Can't access your account?</a></span>
+ </div>
+ <div class="login-signup">
+ <a href="/portal/register">Try</a>, <a href="/portal/register">Sign Up</a> or <a href="/portal/join">Join</a>
+ </div>
+ </form>
+</div>
--- /dev/null
+<div class="well login-widget">
+ {% if state %}
+ <span class="help-block">{{ state }}</span>
+ {% endif %}
+ <form action="/login/" method="post" role="form">
+ {% csrf_token %}
+ {% if next %}
+ <input type="hidden" name="next" value="{{ next }}" />
+ {% endif %}
+ <div class="form-group">
+ <label for="username">Email address / Username</label>
+ <input type="email" class="form-control" name="username" placeholder="Enter Email / username">
+ </div>
+ <div class="form-group">
+ <label for="password">Password</label>
+ <input type="password" class="form-control" name="password" placeholder="Password">
+ </div>
+ <div class="login-submit">
+ <input class="btn btn-default" type="submit" value="Sign In" />
+ <span class="lost-password"> | <a href="/portal/pass_reset/">Can't access your account?</a></span>
+ </div>
+ <div class="login-signup">
+ <a href="/portal/register">Try</a> or <a href="/portal/register">Sign Up</a>
+ </div>
+ </form>
+</div>
--- /dev/null
+
+<div id="header">
+ <div class="wrapper">
+ <div class="logo">
+ <a href="/"><img src="{{ STATIC_URL }}img/fibre-logo.gif" alt="FIBRE" /></a>
+ </div>
+
+ <div id="secondary">
+ <ul>
+ <li>News</li>
+ <li><a href="/portal/about">About</a></li>
+ <li><a target="_blank" href="http://http://www.fibre-ict.eu/">Public Website</a></li>
+ <li><a target="_blank" href="http://intranet.fibre-ict.eu">Intranet</a></li>
+ </ul>
+ </div>
+ </div>
+
+ {% if username %}
+ <div id="navigation">
+ <div class="wrapper">
+ <ul>
+ <li id="nav-account"><a href="/portal/account/">{{ username }}</a></li>
+ <li>|</li>
+ <li id="nav-institution" class=""><a href="/portal/institution">INSTITUTION</a></li>
+ <li class="slices">
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
+ SLICES <span class="caret"></span>
+ </a>
+
+ <div class="dropdown-menu">
+ <ul>
+ <li><a href="/portal/slice_request/">Request Slice</a></li>
+ <li><a href="/slice/ple.upmc.agent3/">ple.upmc.agent3</a></li>
+ <li><a href="/slice/ple.upmc.agent/">ple.upmc.agent</a></li>
+ <li><a href="/slice/ple.upmc.myslicedemo/">ple.upmc.myslicedemo</a></li>
+ <li><a href="/slice/ple.upmc.slicestat/">ple.upmc.slicestat</a></li>
+ <li><a href="/slice/ple.upmc.agent2/">ple.upmc.agent2</a></li>
+ </ul>
+ </div>
+ </li>
+ <li id="nav-request"><a href="/portal/validate">REQUESTS</a></li>
+ <li id="nav-support"><a href="/portal/support/">SUPPORT</a></li>
+ <li>|</li>
+ <li id="nav-logout" style="margin-top: 10px;"><a id="logout" style="cursor:pointer;" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> LOGOUT</a></li>
+ </ul>
+ </div>
+ </div>
+ {% else %}
+ <div id="navigation">
+ <div class="wrapper"></div>
+ </div>
+ {% endif %}
+</div>
+<script>
+ $(document).ready(function() {
+ $('li.slices').mouseenter(function() {
+ $('div#menu-slice-list').fadeIn(100);
+ });
+ $('div#menu-slice-list').mouseleave(function(e) {
+ if (!$('li.slices').is(":hover")) {
+ $(this).fadeOut(100);
+ }
+ });
+ // var slices = localStorage.getItem('slices');
+ // if (slices.length == 0) {
+ // $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
+ // var items = [];
+ // localStorage.setItem('slices', data[0].slice);
+ // });
+ // }
+ // $.each(slices, function( key, val ) {
+ // items.push( "<li><a href=\"/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></li>" );
+ // });
+ // $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
+ });
+</script>
--- /dev/null
+{% extends "layout.html" %}
+
+{% block content %}
+<div class="row" id="home-dashboard">
+ <ul class="nav nav-tabs">
+ <li class="active"><a class="home-tab" data-panel="user" href="#">USER</a></li>
+ <li><a class="home-tab" data-panel="manager" href="#">MANAGER</a></li>
+ </ul>
+ <div class="home-panel" id="user">
+ <table>
+ <tr>
+ <td>ACCOUNT</td>
+ <td>SLICES</td>
+ <td>SUPPORT</td>
+ </tr>
+ <tr>
+ <td><a href="/portal/account/"><img src="{{ STATIC_URL }}img/icon_user_color.png" alt="" /></a></td>
+ <td><a href="#"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a></td>
+ <td><a href="/portal/support"><img src="{{ STATIC_URL }}img/icon_support.png" alt="" /></a></td>
+ </tr>
+ <tr>
+ {% if person %}
+ <td class="logged-in">
+ <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
+ <div>
+ {% if person.last_name %}
+ {{person.first_name}} {{person.last_name}}<br />
+ {% endif %}
+ <span class="label">Email:</span> <a href='/portal/account/'>{{person.email}}</a>
+ </div>
+ {% else %}
+ <td>
+ {% include 'onelab__widget-login-user.html' %}
+ {% endif %}
+ </td>
+ <td>
+ {% if person %}
+ <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Request Slice</button>
+ <div id="home-slice-list"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
+ {% else %}
+ {% endif %}
+ </td>
+ <td class="support">
+ <button id="ticketbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create Ticket</button>
+ <div>
+ <a href="/portal/contact">Contact</a> <br />
+ <a href="/portal/support/documentation">Documentation</a>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div class="home-panel" id="manager">
+ <table>
+ <tr>
+ <td>INSTITUTION</td>
+ <td>SLICES</td>
+ <td>REQUESTS</td>
+ </tr>
+ <tr>
+ <td><a href="/portal/institution"><img src="{{ STATIC_URL }}img/icon_authority_color.png" alt="" /></a></td>
+ <td><a href="/portal/institution#slices"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a></td>
+ <td><a href="/portal/validate"><img src="{{ STATIC_URL }}img/icon_testbed_color.png" alt="" /></a></td>
+ </tr>
+ <tr>
+ {% if person %}
+ <td class="logged-in">
+ <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
+ {% else %}
+ <td>
+ {% include 'onelab__widget-login-manager.html' %}
+ {% endif %}
+ </td>
+ <td>
+ {% if person %}
+ <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create Slice</button>
+ {% endif %}
+ </td>
+ <td class="support">
+ {% if person %}
+ <button id="validaterequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-ok"></span> Validate Requests</button>
+ {% endif %}
+ </td>
+ </tr>
+ </table>
+ </div>
+</div>
+<script>
+ $(document).ready(function() {
+ $('a.home-tab').click(function() {
+ $('ul.nav-tabs li').removeClass('active');
+ $(this).parent().addClass('active');
+ $('div.home-panel').hide();
+ $('div#'+$(this).data('panel')).show();
+ });
+ $('button#validaterequestbtn').click(function() {
+ window.location="/portal/validate/";
+ });
+ $('button#ticketbtn').click(function() {
+ window.location="/portal/contact/";
+ });
+ $('button#slicerequestbtn').click(function() {
+ window.location="/portal/slice_request/";
+ });
+
+ {% if person %}
+ $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
+ var items = [];
+ $.each( data[0].slices, function(i, val) {
+ items.push( "<li><a href=\"/slice/"+val+"\">" + val + "</a></li>" );
+ });
+
+ $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
+
+ });
+ {% endif %}
+ });
+</script>
+{% endblock %}
<body ng-app="ManifoldApp">
{% block container %}
{% block topmenu %}
- {% include theme|add:"__widget-topmenu.html" %}
+ {% include theme|add:"_widget-topmenu.html" %}
{% endblock topmenu %}
{% include 'messages-transient.html' %}
{% block base_content %}
{% block content %}
<div class="row">
- <h1><img src="{{ STATIC_URL }}img/icon_user_small.png" alt="User Registration" /> OneLab Experimenter Registration</h1>
+ <h1><img src="{{ STATIC_URL }}img/icon_user_small.png" alt="User Registration" /> FIBRE Experimenter Registration</h1>
</div>
<div class="row">
--- /dev/null
+{# This is required by insert_above #}{% insert_handler %}<!DOCTYPE html>
+<html lang="en"><head>
+<title>FIBRE - {{ section }}</title>
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<link rel="shortcut icon" href="/static/img/myslice-icon.png">
+{# This is where insert_str will end up #}{% media_container prelude %}
+{% include 'messages-transient-header.html' %}
+<script type="text/javascript"> {# raw js code - use {% insert prelude_js %} ... {% endinsert %} #} {% container prelude_js %}</script>
+<script src="{{ STATIC_URL }}js/jquery.dataTables.min.js"></script>
+<script src="{{ STATIC_URL }}js/bootstrap.datatables.js"></script>
+<script src="{{ STATIC_URL }}js/myslice-ui.js"></script>
+<style type="text/css">{# In case we need to add raw css code #}{% container prelude_css %}</style>
+{{ header_prelude }}
+{% block head %} {% endblock head %}
+{# let's add these ones no matter what #}
+{% insert_str prelude "js/jquery.min.js" %}
+{% insert_str prelude "js/jquery.html5storage.min.js" %}
+{% insert_str prelude "js/messages-runtime.js" %}
+{% insert_str prelude "js/class.js" %}
+{% insert_str prelude "js/plugin-helper.js" %}
+{% insert_str prelude "js/mustache.js" %}
+{% insert_str prelude "js/plugin.js" %}
+{% insert_str prelude "js/manifold.js" %}
+{% insert_str prelude "css/manifold.css" %}
+{% insert_str prelude "css/plugin.css" %}
+<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/{{ theme }}.css">
+</head>
+<body>
+{% block container %}
+ {% block topmenu %}
+ {% include theme|add:"__widget-topmenu.html" %}
+ {% endblock topmenu %}
+ {% include 'messages-transient.html' %}
+ {% block base_content %}
+ {% endblock %}
+{% endblock container %}
+</body>
+</html>