added permissions api and websocket stuff
This commit is contained in:
@@ -486,6 +486,22 @@ class Permission(db.Model):
|
||||
back_populates='permissions')
|
||||
access_control_entry = db.relationship('AccessControlEntry', back_populates='required_permission')
|
||||
|
||||
@staticmethod
|
||||
def get_by_name(name):
|
||||
"""
|
||||
Find permission by name
|
||||
:param name:
|
||||
:return:
|
||||
"""
|
||||
return Permission.query.filter(Permission.name == name).first()
|
||||
|
||||
@staticmethod
|
||||
def get_all():
|
||||
"""
|
||||
Return all permissions
|
||||
:return:
|
||||
"""
|
||||
return Permission.query.all()
|
||||
|
||||
@event.listens_for(User.__table__, 'after_create')
|
||||
def insert_initial_users(*args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user