Exemple #1
0
def db_create():
    "Will create the database."
    with application.app_context():
        mosp.models.db_create(
            db,
            application.config["DB_CONFIG_DICT"],
            application.config["DATABASE_NAME"],
        )
Exemple #2
0
from mosp.bootstrap import application
from mosp import commands


def register_commands(app):
    """Register Click commands."""
    app.cli.add_command(commands.uml_graph)
    app.cli.add_command(commands.db_empty)
    app.cli.add_command(commands.db_create)
    app.cli.add_command(commands.db_init)
    app.cli.add_command(commands.import_licenses_from_spdx)
    app.cli.add_command(commands.create_admin)
    app.cli.add_command(commands.create_user)


with application.app_context():

    from mosp.web import views

    application.register_blueprint(views.schema_bp)
    application.register_blueprint(views.schemas_bp)
    application.register_blueprint(views.object_bp)
    application.register_blueprint(views.objects_bp)
    application.register_blueprint(views.admin_bp)
    application.register_blueprint(views.user_bp)
    application.register_blueprint(views.organization_bp)
    application.register_blueprint(views.organizations_bp)

    application.register_blueprint(views.stats_bp)

    # API v1
Exemple #3
0
def create_admin(login, email, password):
    "Initializes an admin user"
    print(f"Creation of the admin user {login} ...")
    with application.app_context():
        mosp.scripts.create_user(login, email, password, True, True)
Exemple #4
0
def import_licenses_from_spdx():
    "Import licenses from spdx.org."
    print("Importing licenses from spdx.org...")
    with application.app_context():
        mosp.scripts.import_licenses_from_spdx()
Exemple #5
0
def db_init():
    "Will create the database from conf parameters."
    with application.app_context():
        mosp.models.db_init(db)
Exemple #6
0
def db_empty():
    "Will drop every datas stocked in db."
    with application.app_context():
        mosp.models.db_empty(db)
Exemple #7
0
def uml_graph():
    "UML graph from the models."
    with application.app_context():
        mosp.models.uml_graph(db)
Exemple #8
0
def create_admin(login, password):
    "Initializes an admin user"
    print("Creation of the admin user {} ...".format(login))
    with application.app_context():
        mosp.scripts.create_user(login, password, True)
Exemple #9
0
def create_user(login, email, password):
    "Initializes a user"
    print("Creation of the user {} ...".format(login))
    with application.app_context():
        mosp.scripts.create_user(login, email, password, False)