# Path: auth/constants.py
# AUTH_ALLOWED = 1
# AUTH_DENIED = 0
# AUTH_ERROR = -1
# AUTH_VALIDATION = 5
# AUTH_VALIDATION_FAILED = 6
# STAGE_COUNTERS = 'counters'
# STAGE_LOGIN = 'login'
# STAGE_LOGOUT = 'logout'
# ROLES = {
#     u'super-admin': u'Super Admin',
#     u'network-admin': u'Network Admin',
#     u'gateway-admin': u'Gateway Admin',
#     u'service': u'Service',
# }
# STATUS_ICONS = {
#     'active': 'bolt',
#     'archived': 'trash',
#     'blocked': 'thumb-down',
#     'ended': 'flag',
#     'expired': 'circle-x',
#     'new': 'file',
# }
# ACTIONS = {
#     'vouchers': [
#         'extend',
#         'block',
#         'unblock',
#         'archive',
#     ],
# }
# 
# Path: auth/graphs.py
# def available_actions(status, interface):
#     if status in states:
#         result = {}
#         for action, defn in six.iteritems(actions):
#             if action in states[status] and defn['interface'] == interface:
#                 result[action] = defn
#         return result
# 
#     return {}


import base64
import datetime
import json
import re
import string
import flask
from auth import constants
from auth.graphs import available_actions
from flask import current_app
from flask_security import UserMixin, RoleMixin, current_user, SQLAlchemyUserDatastore
from flask_sqlalchemy import SQLAlchemy
from random import choice
from sqlalchemy import event
from sqlalchemy.engine import Engine
from sqlalchemy.orm import backref
from sqlalchemy.schema import UniqueConstraint
    def extend(self):
        self.minutes += 30

    @record_change
    def login(self):
        self.started_at = datetime.datetime.utcnow()
        self.status = 'active'

    @record_change
    def end(self):
        self.status = 'ended'

    @record_change
    def expire(self):
        self.status = 'expired'

    @record_change
    def block(self):
        self.status = 'blocked'

    @record_change
    def unblock(self):
        self.status = 'active'

    @record_change
    def archive(self):
        self.status = 'archived'

    @property
    def available_actions(self):

# Path: auth/constants.py
# AUTH_ALLOWED = 1
# AUTH_DENIED = 0
# AUTH_ERROR = -1
# AUTH_VALIDATION = 5
# AUTH_VALIDATION_FAILED = 6
# STAGE_COUNTERS = 'counters'
# STAGE_LOGIN = 'login'
# STAGE_LOGOUT = 'logout'
# ROLES = {
#     u'super-admin': u'Super Admin',
#     u'network-admin': u'Network Admin',
#     u'gateway-admin': u'Gateway Admin',
#     u'service': u'Service',
# }
# STATUS_ICONS = {
#     'active': 'bolt',
#     'archived': 'trash',
#     'blocked': 'thumb-down',
#     'ended': 'flag',
#     'expired': 'circle-x',
#     'new': 'file',
# }
# ACTIONS = {
#     'vouchers': [
#         'extend',
#         'block',
#         'unblock',
#         'archive',
#     ],
# }
# 
# Path: auth/graphs.py
# def available_actions(status, interface):
#     if status in states:
#         result = {}
#         for action, defn in six.iteritems(actions):
#             if action in states[status] and defn['interface'] == interface:
#                 result[action] = defn
#         return result
# 
#     return {}


# Path: auth/models.py
import base64
import datetime
import json
import re
import string
import flask
from auth import constants
from auth.graphs import available_actions
from flask import current_app
from flask_security import UserMixin, RoleMixin, current_user, SQLAlchemyUserDatastore
from flask_sqlalchemy import SQLAlchemy
from random import choice
from sqlalchemy import event
from sqlalchemy.engine import Engine
from sqlalchemy.orm import backref
from sqlalchemy.schema import UniqueConstraint

    def extend(self):
        self.minutes += 30

    @record_change
    def login(self):
        self.started_at = datetime.datetime.utcnow()
        self.status = 'active'

    @record_change
    def end(self):
        self.status = 'ended'

    @record_change
    def expire(self):
        self.status = 'expired'

    @record_change
    def block(self):
        self.status = 'blocked'

    @record_change
    def unblock(self):
        self.status = 'active'

    @record_change
    def archive(self):
        self.status = 'archived'

    @property
    def available_actions(self):

        return available_actions(self.status, 'admin')