mirror of
https://github.com/logos-co/open-law.git
synced 2025-01-24 05:38:52 +00:00
23 lines
596 B
Python
23 lines
596 B
Python
from app import db
|
|
from app.models.utils import BaseModel
|
|
|
|
|
|
class AccessGroup(BaseModel):
|
|
__tablename__ = "access_groups"
|
|
|
|
name = db.Column(db.String(32), nullable=False)
|
|
|
|
# Foreign Keys
|
|
book_id = db.Column(db.Integer, db.ForeignKey("books.id"))
|
|
|
|
# Relationships
|
|
book = db.relationship("Book", viewonly=True)
|
|
permissions = db.relationship(
|
|
"Permission",
|
|
secondary="permissions_access_groups",
|
|
back_populates="access_groups",
|
|
)
|
|
users = db.relationship(
|
|
"User", secondary="users_access_groups", back_populates="permissions"
|
|
)
|