class MemberRole(db.Model): member = db.Column(db.String(36), db.ForeignKey('member.uuid'), primary_key=True) role = db.Column(db.String(36), db.ForeignKey('role.uuid'), primary_key=True)
class Approval(db.Model): member = db.Column(db.String(36), db.ForeignKey('member.uuid'), primary_key=True) decision = db.Column(db.String(36), db.ForeignKey('decision.uuid'), primary_key=True)
class PolicyRole(db.Model): """ defines RO/RW permissions on a decision for roles associated with a policy. Additionally, members with roles that have write permissions for decisions associated with this policy may create decisions that use this policy. """ policy = db.Column(db.String(36), db.ForeignKey('policy.uuid'), primary_key=True) role = db.Column(db.String(36), db.ForeignKey('role.uuid'), primary_key=True) read = db.Column(db.Boolean()) write = db.Column(db.Boolean()) quorum_weight = db.Column(db.Integer())
class Server(db.Model): id = db.Column(db.Integer, primary_key=True) fqdn = db.Column(db.String(128)) port = db.Column(db.Integer, default=443) def __repr__(self): return '{}:{}'.format(self.fqdn, self.port)
class Organization(db.Model): ''' Key concepts: member_role: This is the role that signifies the membership to this organization, therefore, all members of an organization have this role. mod_role: Members of the organization's mod role have the exclusive permission to create decisions flagged with mod_role_req. Default plugin meta_plugin has functions create_policy(), create_role(), and add_member_to_org(), which are flagged with this property. ''' uuid = db.Column(db.String(36), primary_key=True) name = db.Column(db.String(128)) server = db.Column(db.Integer, db.ForeignKey('server.id')) member_role = db.Column(db.String, db.ForeignKey('role.uuid')) mod_role = db.Column(db.String, db.ForeignKey('role.uuid'))
class Decision(db.Model): uuid = db.Column(db.String(36), unique=True, primary_key=True) title = db.Column(db.String(512)) org = db.Column(db.String(36), db.ForeignKey('organization.uuid')) author = db.Column(db.String(36), db.ForeignKey('member.uuid')) plugin = db.Column(db.Integer, db.ForeignKey('plugin.uuid')) directory = db.Column(db.String(512)) policy = db.Column(db.String(36), db.ForeignKey('policy.uuid'))
class Role(db.Model): uuid = db.Column(db.String(36), primary_key=True) name = db.Column(db.String(128)) org = db.Column(db.String(36), db.ForeignKey('organization.uuid'))
class Plugin(db.Model): uuid = db.Column(db.String(36), primary_key=True) title = db.Column(db.String(128), unique=True) module_name = db.Column(db.String(128)) path = db.Column(db.String(1024), unique=True)
class MemberDigest(db.Model): member = db.Column(db.String(36), db.ForeignKey('member.uuid'), primary_key=True) digest = db.Column(db.String(160))
class Member(db.Model): uuid = db.Column(db.String(36), unique=True, primary_key=True) email = db.Column(db.String(256), unique=True) name = db.Column(db.String(128)) server = db.Column(db.Integer, db.ForeignKey('server.id'))
class Configuration(db.Model): name = db.Column(db.String(64), primary_key=True, unique=True) any_member_may_create_orgs = db.Column(db.Boolean, default=True) open_enrollment = db.Column(db.Boolean, default=True) decision_path = db.Column(db.String(128)) public_org = db.Column(db.String, db.ForeignKey('organization.uuid'))
class Policy(db.Model): uuid = db.Column(db.String(36), primary_key=True) name = db.Column(db.String(128))