# 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
    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:
        for name, description in six.iteritems(ROLES):
            create_role(name, description, quiet)
        if not quiet:
            print('Roles created')


@manager.command
def create_role(name, description, quiet=True):
    role = users.create_role(name=name, description=description)
    db.session.add(role)
    db.session.commit()
    if not quiet:
        print('Role created')


@manager.command
def process_vouchers():
    # Active vouchers that should end

# 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

    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:
        for name, description in six.iteritems(ROLES):
            create_role(name, description, quiet)
        if not quiet:
            print('Roles created')


@manager.command
def create_role(name, description, quiet=True):
    role = users.create_role(name=name, description=description)
    db.session.add(role)
    db.session.commit()
    if not quiet:
        print('Role created')


@manager.command
def process_vouchers():
    # Active vouchers that should end

    vouchers = Voucher.query \