From 4d8e0f32b76eec997cecea582a4b9e822ba3c80d Mon Sep 17 00:00:00 2001 From: Jarret Raim Date: Sun, 17 Feb 2013 17:16:45 -0600 Subject: [PATCH] Added basic policies --- models.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/models.py b/models.py index 095fb36d0..fe83a7818 100644 --- a/models.py +++ b/models.py @@ -67,7 +67,7 @@ class Key(Base): secret = Column(Text) tenant_id = Column(Integer, ForeignKey('tenants.id')) - tenant = relationship("Tenant", backref=backref('tenants', order_by=id)) + tenant = relationship("Tenant", backref=backref('keys', order_by=id)) def __init__(self, uuid=None): if uuid is None: @@ -75,3 +75,19 @@ class Key(Base): def __repr__(self): return '' % self.uuid + + +class Policy(Base): + __tablename__ = 'policies' + id = Column(Integer, primary_key=True) + uuid = Column(String(36), unique=True) + + tenant_id = Column(Integer, ForeignKey('tenants.id')) + tenant = relationship("Tenant", backref=backref('policies', order_by=id)) + + def __init__(self, uuid=None): + if uuid is None: + self.uuid = str(uuid4()) + + def __repr__(self): + return '' % self.uuid \ No newline at end of file