admin API with internal network

This commit is contained in:
2025-06-06 09:03:39 +02:00
parent 57fa221d47
commit 56177b2811
4 changed files with 506 additions and 2 deletions

View File

@@ -477,4 +477,20 @@ def user_has_permission(room, perm_name):
return perm_name == 'can_view'
# Check the specific permission
return getattr(permission, perm_name, False)
return getattr(permission, perm_name, False)
class ManagementAPIKey(db.Model):
__tablename__ = 'management_api_keys'
id = db.Column(db.Integer, primary_key=True)
api_key = db.Column(db.String(100), unique=True, nullable=False)
name = db.Column(db.String(100), nullable=False) # Name/description of the management tool
created_at = db.Column(db.DateTime, default=datetime.utcnow)
last_used_at = db.Column(db.DateTime)
is_active = db.Column(db.Boolean, default=True)
created_by = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='SET NULL'))
# Relationships
creator = db.relationship('User', backref=db.backref('created_api_keys', cascade='all, delete-orphan'))
def __repr__(self):
return f'<ManagementAPIKey {self.name}>'