# Path: makesite/modules/flask/base/core/models.py
# class BaseMixin(UpdateMixin, TimestampMixin):
#     """Provieds all benefits of
#     :class:`~pyramid_alchauth.models.UpdateMixin` and
#     :class:`~pyramid_alchauth.models.TimestampMixin` as well as
#     providing a deform compatible appstruct property and an easy way to
#     query VersionedMeta. It also defines an id column to save on boring
#     boilerplate.
#     """
# 
#     id = Column(Integer, primary_key=True)
# 
#     @declared_attr
#     def __tablename__(self):
#         return self.__name__.lower()
# 
#     @property
#     def session(self):
#         return object_session(self)
# 
#     @property
#     def _history_class(self):
#         """Returns the corresponding history class if the inheriting
#         class supports versioning (by checking for the existence of a
#         '__history_mapper__' attribute). Otherwise, returns None.
#         """
#         if hasattr(self, '__history_mapper__'):
#             return self.__history_mapper__.class_
#         else:
#             return None
# 
#     @property
#     def history(self):
#         """Returns an SQLAlchemy query of the object's history (previous
#         versions). If the class does not support history/versioning,
#         returns None.
#         """
#         history = self.history_class
#         if history:
#             return self.session.query(history).filter(history.id == self.id)
#         else:
#             return None
# 
#     def generate_appstruct(self):
#         """Returns a Deform compatible appstruct of the object and it's
#         properties. Does not recurse into SQLAlchemy relationships.
#         An example using the :class:`~drinks.models.User` class (that
#         inherits from BaseMixin):
# 
#         .. code-block:: python
# 
#             >>> user = User(username='mcuserpants', disabled=True)
#             >>> user.appstruct
#             {'disabled': True, 'username': 'mcuserpants'}
# 
#         """
#         mapper = object_mapper(self)
#         return dict([(p.key, self.__getattribute__(p.key)) for
#                      p in mapper.iterate_properties if
#                      not self.__getattribute__(p.key) is None])
# 
#     @property
#     def appstruct(self):
#         return self.generate_appstruct()
# 
# Path: makesite/modules/flask/base/ext.py
# def config_extensions(app):
# def config_babel(app):
#     def get_locale():


from flask_login import UserMixin
from flask_principal import RoleNeed, Permission
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.ext.hybrid import hybrid_property
from werkzeug import check_password_hash, generate_password_hash
from ..core.models import BaseMixin
from ..ext import db



userroles = db.Table(
    'users_userroles',
    db.Column('user_id', db.Integer, db.ForeignKey('users_user.id')),
    db.Column('role_id', db.Integer, db.ForeignKey('users_role.id'))
)



# Path: makesite/modules/flask/base/core/models.py
# class BaseMixin(UpdateMixin, TimestampMixin):
#     """Provieds all benefits of
#     :class:`~pyramid_alchauth.models.UpdateMixin` and
#     :class:`~pyramid_alchauth.models.TimestampMixin` as well as
#     providing a deform compatible appstruct property and an easy way to
#     query VersionedMeta. It also defines an id column to save on boring
#     boilerplate.
#     """
# 
#     id = Column(Integer, primary_key=True)
# 
#     @declared_attr
#     def __tablename__(self):
#         return self.__name__.lower()
# 
#     @property
#     def session(self):
#         return object_session(self)
# 
#     @property
#     def _history_class(self):
#         """Returns the corresponding history class if the inheriting
#         class supports versioning (by checking for the existence of a
#         '__history_mapper__' attribute). Otherwise, returns None.
#         """
#         if hasattr(self, '__history_mapper__'):
#             return self.__history_mapper__.class_
#         else:
#             return None
# 
#     @property
#     def history(self):
#         """Returns an SQLAlchemy query of the object's history (previous
#         versions). If the class does not support history/versioning,
#         returns None.
#         """
#         history = self.history_class
#         if history:
#             return self.session.query(history).filter(history.id == self.id)
#         else:
#             return None
# 
#     def generate_appstruct(self):
#         """Returns a Deform compatible appstruct of the object and it's
#         properties. Does not recurse into SQLAlchemy relationships.
#         An example using the :class:`~drinks.models.User` class (that
#         inherits from BaseMixin):
# 
#         .. code-block:: python
# 
#             >>> user = User(username='mcuserpants', disabled=True)
#             >>> user.appstruct
#             {'disabled': True, 'username': 'mcuserpants'}
# 
#         """
#         mapper = object_mapper(self)
#         return dict([(p.key, self.__getattribute__(p.key)) for
#                      p in mapper.iterate_properties if
#                      not self.__getattribute__(p.key) is None])
# 
#     @property
#     def appstruct(self):
#         return self.generate_appstruct()
# 
# Path: makesite/modules/flask/base/ext.py
# def config_extensions(app):
# def config_babel(app):
#     def get_locale():


# Path: makesite/modules/flask/base/auth/models.py
from flask_login import UserMixin
from flask_principal import RoleNeed, Permission
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.ext.hybrid import hybrid_property
from werkzeug import check_password_hash, generate_password_hash
from ..core.models import BaseMixin
from ..ext import db




userroles = db.Table(
    'users_userroles',
    db.Column('user_id', db.Integer, db.ForeignKey('users_user.id')),
    db.Column('role_id', db.Integer, db.ForeignKey('users_role.id'))
)



class Role(db.Model, BaseMixin):