2015-06-22 22:47:27 +02:00
|
|
|
"""
|
2015-08-09 01:12:29 +02:00
|
|
|
.. module: lemur.roles.models
|
2015-06-22 22:47:27 +02:00
|
|
|
:platform: unix
|
|
|
|
:synopsis: This module contains all of the models need to create a role within Lemur
|
|
|
|
|
|
|
|
:copyright: (c) 2015 by Netflix Inc., see AUTHORS for more
|
|
|
|
:license: Apache, see LICENSE for more details.
|
|
|
|
|
|
|
|
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
|
|
|
|
|
|
|
|
"""
|
|
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from sqlalchemy import Column, Integer, String, Text, ForeignKey
|
|
|
|
|
|
|
|
from lemur.database import db
|
2015-10-10 02:17:05 +02:00
|
|
|
from lemur.utils import Vault
|
2015-06-22 22:47:27 +02:00
|
|
|
from lemur.models import roles_users
|
|
|
|
|
|
|
|
|
|
|
|
class Role(db.Model):
|
|
|
|
__tablename__ = 'roles'
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
|
|
name = Column(String(128), unique=True)
|
|
|
|
username = Column(String(128))
|
2015-10-10 02:17:05 +02:00
|
|
|
password = Column(Vault)
|
2015-06-22 22:47:27 +02:00
|
|
|
description = Column(Text)
|
|
|
|
authority_id = Column(Integer, ForeignKey('authorities.id'))
|
|
|
|
user_id = Column(Integer, ForeignKey('users.id'))
|
2016-05-10 23:22:22 +02:00
|
|
|
users = relationship("User", secondary=roles_users, viewonly=True, backref="role")
|