<commit_before># -*-*- encoding: utf-8 -*-*-
#
# gateway4labs is free software: you can redistribute it and/or modify
# it under the terms of the BSD 2-Clause License
# gateway4labs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

import json
import hashlib

from .db import db_session, init_db
from .models import LmsUser, PermissionToLms, Laboratory, PermissionToLmsUser
from .models import LMS, RLMS, PermissionToCourse, BasicHttpCredentials, ShindigCredentials, Course

def add_sample_users():

    init_db(drop = True)

    #################################################
    # 
    #     RLMS 1: WebLab-Deusto
    #   

    weblabdeusto_configuration = {
        'remote_login' : 'labmanager',
        'password'     : 'password',
        'base_url'     : 'http://www.weblab.deusto.es/weblab/',
    }

    rlms_weblabdeusto = RLMS(kind = u"WebLab-Deusto",
                       location = u"Bilbao, Spain",
                       url = u"https://www.weblab.deusto.es/",
                       version = u"5.0",
                       configuration = json.dumps(weblabdeusto_configuration) )
    db_session.add(rlms_weblabdeusto)

    robot_lab = Laboratory(name = u"robot-movement@Robot experiments",
                           laboratory_id = u"robot-movement@Robot experiments",
                           rlms = rlms_weblabdeusto)

    db_session.add(robot_lab)

    #######################################################
    # 
    #     RLMS 2: FCEIA UNR
    #   

    rlms_unr = RLMS(kind = u'FCEIA-UNR',
                       location = u'Rosario, Argentina',
                       url = u'http://labremf4a.fceia.unr.edu.ar/accesodeusto.aspx',
                       version = u"1.2.2",
                       configuration = json.dumps(dict(remote_login = 'login', password = 'password')))
    db_session.add(rlms_unr)

    physics_lab = Laboratory(name = u'unr-physics',
                           laboratory_id = u'unr-physics',
                           rlms = rlms_unr)

    db_session.add(physics_lab)


    #######################################################
    # 
    #     RLMS 3: iLabs (not implemented at this moment)
    #   


    rlms_ilab = RLMS(kind = u'iLabs',
                       location = u'MIT',
                       url = u'http://ilab.mit.edu/wiki/',
                       version = u"1.2.2")
    db_session.add(rlms_ilab)


    #######################################################
    #     
    #     LMS 1: Using LTI
    #    

    lms1 = LMS(full_name = u"<NAME> (LTI)", name = "deusto",
                     url = u"http://alud2.deusto.es/")
    db_session.add(lms1)

    password = unicode(hashlib.new('sha', 'password').hexdigest())<commit_msg>Add more appropriate iLab sample data<commit_after># -*-*- encoding: utf-8 -*-*-
#
# gateway4labs is free software: you can redistribute it and/or modify
# it under the terms of the BSD 2-Clause License
# gateway4labs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

import json
import hashlib

from .db import db_session, init_db
from .models import LmsUser, PermissionToLms, Laboratory, PermissionToLmsUser
from .models import LMS, RLMS, PermissionToCourse, BasicHttpCredentials, ShindigCredentials, Course

def add_sample_users():

    init_db(drop = True)

    #################################################
    # 
    #     RLMS 1: WebLab-Deusto
    #   

    weblabdeusto_configuration = {
        'remote_login' : 'labmanager',
        'password'     : 'password',
        'base_url'     : 'http://www.weblab.deusto.es/weblab/',
    }

    rlms_weblabdeusto = RLMS(kind = u"WebLab-Deusto",
                       location = u"Bilbao, Spain",
                       url = u"https://www.weblab.deusto.es/",
                       version = u"5.0",
                       configuration = json.dumps(weblabdeusto_configuration) )
    db_session.add(rlms_weblabdeusto)

    robot_lab = Laboratory(name = u"robot-movement@Robot experiments",
                           laboratory_id = u"robot-movement@Robot experiments",
                           rlms = rlms_weblabdeusto)

    db_session.add(robot_lab)

    #######################################################
    # 
    #     RLMS 2: FCEIA UNR
    #   

    rlms_unr = RLMS(kind = u'FCEIA-UNR',
                       location = u'Rosario, Argentina',
                       url = u'http://labremf4a.fceia.unr.edu.ar/accesodeusto.aspx',
                       version = u"1.2.2",
                       configuration = json.dumps(dict(remote_login = 'login', password = 'password')))
    db_session.add(rlms_unr)

    physics_lab = Laboratory(name = u'unr-physics',
                           laboratory_id = u'unr-physics',
                           rlms = rlms_unr)

    db_session.add(physics_lab)


    #######################################################
    # 
    #     RLMS 3: iLabs (not implemented at this moment)
    #   


    rlms_ilab = RLMS(kind = u'iLabs',
                       location = u'MIT',
                       url = u'http://ilab.mit.edu/wiki/',
                       version = u"1.0"
                       configuration = json.dumps(dict(
                            sb_guid = 'ISB-247A4591CA1443485D85657CF357',
                            sb_url  = 'http://ludi.mit.edu/iLabServiceBroker/iLabServiceBroker.asmx',
                            authority_guid = 'fakeGUIDforRMLStest-12345',
                            group_name = 'Experiment_Group',
                       )))
    db_session.add(rlms_ilab)


    #######################################################
    #     
    #     LMS 1: Using LTI
    #    

    lms1 = LMS(full_name = u"<NAME> (LTI)", name = "deusto",
                     url = u"http://alud2.deusto.es/")
    db_session.add(lms1)

    password = unicode(hashlib.new('sha', 'password').hexdigest())
{'fraction_non_alphanumeric': 0.16932697054467666, 'fraction_numerical': 0.010860622017442817, 'mean_word_length': 2.042042042042042, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5970094', 'n_tokens_mistral': 1980, 'n_tokens_neox': 1837, 'n_words': 362}