feat: permission permissions
All checks were successful
ci / lint_and_test (push) Successful in 16s

Orgs can only grant permissions to groups that they themselves have been granted access to.

Super admin bypasses not added, flagged as todos.
This commit is contained in:
Chris Milne 2026-06-16 13:51:31 +01:00
parent 0a867c9c90
commit 662b9c8e26
6 changed files with 71 additions and 4 deletions

View file

@ -52,6 +52,10 @@ class Permission(Base):
"Group", secondary="group_permissions", back_populates="permission_rel"
)
org_rel = relationship(
"Organisation", secondary="org_permissions", back_populates="permission_rel"
)
class Group(Base):
__tablename__ = "group"
@ -95,3 +99,13 @@ class UserGroups(Base):
group_id = Column(
Integer, ForeignKey("group.id", ondelete="CASCADE"), primary_key=True
)
class OrgPermissions(Base):
__tablename__ = "org_permissions"
org_id = Column(
Integer, ForeignKey("organisation.id", ondelete="CASCADE"), primary_key=True
)
permission_id = Column(
Integer, ForeignKey("permission.id", ondelete="CASCADE"), primary_key=True
)