# Path: auth/constants.py
# ROLES = {
#     u'super-admin': u'Super Admin',
#     u'network-admin': u'Network Admin',
#     u'gateway-admin': u'Gateway Admin',
#     u'service': u'Service',
# }
# 
# Path: auth/models.py
# def set_sqlite_pragma(dbapi_connection, connection_record):
# def generate_code():
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# def record_change(f):
#     def func(self, **kwargs):
#     def should_expire(self):
#     def should_end(self):
#     def megabytes_are_finished(self):
#     def time_left(self):
#     def end_at(self):
#     def extend(self):
#     def login(self):
#     def end(self):
#     def expire(self):
#     def block(self):
#     def unblock(self):
#     def archive(self):
#     def available_actions(self):
#     def __str__(self):
#     def matches_voucher(self, voucher):
#     def process_request(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# class Role(db.Model, RoleMixin):
# class User(db.Model, UserMixin):
# class Network(db.Model):
# class Gateway(db.Model):
# class Voucher(db.Model):
# class Auth(db.Model):
# class Change(db.Model):
# class Country(db.Model):
# class Currency(db.Model):
# class Category(db.Model):
# class Product(db.Model):
# class Order(db.Model):
# class OrderItem(db.Model):
# class Transaction(db.Model):
# 
# Path: auth/services.py



import csv
import datetime
import json
import six
from auth.constants import ROLES
from auth.models import Role, Network, Gateway, Voucher, Country, Currency, Product, db, users
from auth.services import manager
from flask import current_app
from flask_script import prompt, prompt_pass
from flask_security.utils import encrypt_password
from sqlalchemy import func
            return
        if gateway is None:
            print('Gateway is required for a gateway admin')
            return

    user = users.create_user(email=email, password=encrypt_password(password))

    user.network_id = network
    user.gateway_id = gateway

    if confirmed:
        user.confirmed_at = datetime.datetime.now()

    if role is not None:
        role = Role.query.filter_by(name=role).first()
        user.roles.append(role)

    db.session.commit()

    if not quiet:
        print('User created')


@manager.command
def auth_token(email):
    return users.get_user(email).get_auth_token()


@manager.command
def create_roles(quiet=True):

# Path: auth/constants.py
# ROLES = {
#     u'super-admin': u'Super Admin',
#     u'network-admin': u'Network Admin',
#     u'gateway-admin': u'Gateway Admin',
#     u'service': u'Service',
# }
# 
# Path: auth/models.py
# def set_sqlite_pragma(dbapi_connection, connection_record):
# def generate_code():
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# def record_change(f):
#     def func(self, **kwargs):
#     def should_expire(self):
#     def should_end(self):
#     def megabytes_are_finished(self):
#     def time_left(self):
#     def end_at(self):
#     def extend(self):
#     def login(self):
#     def end(self):
#     def expire(self):
#     def block(self):
#     def unblock(self):
#     def archive(self):
#     def available_actions(self):
#     def __str__(self):
#     def matches_voucher(self, voucher):
#     def process_request(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
# class Role(db.Model, RoleMixin):
# class User(db.Model, UserMixin):
# class Network(db.Model):
# class Gateway(db.Model):
# class Voucher(db.Model):
# class Auth(db.Model):
# class Change(db.Model):
# class Country(db.Model):
# class Currency(db.Model):
# class Category(db.Model):
# class Product(db.Model):
# class Order(db.Model):
# class OrderItem(db.Model):
# class Transaction(db.Model):
# 
# Path: auth/services.py



# Path: auth/commands.py
import csv
import datetime
import json
import six
from auth.constants import ROLES
from auth.models import Role, Network, Gateway, Voucher, Country, Currency, Product, db, users
from auth.services import manager
from flask import current_app
from flask_script import prompt, prompt_pass
from flask_security.utils import encrypt_password
from sqlalchemy import func

            return
        if gateway is None:
            print('Gateway is required for a gateway admin')
            return

    user = users.create_user(email=email, password=encrypt_password(password))

    user.network_id = network
    user.gateway_id = gateway

    if confirmed:
        user.confirmed_at = datetime.datetime.now()

    if role is not None:
        role = Role.query.filter_by(name=role).first()
        user.roles.append(role)

    db.session.commit()

    if not quiet:
        print('User created')


@manager.command
def auth_token(email):
    return users.get_user(email).get_auth_token()


@manager.command
def create_roles(quiet=True):

    if Role.query.count() == 0: