make is_administrator a property, add back db events

This commit is contained in:
Patrick Jentsch
2024-04-11 14:33:47 +02:00
parent d0d2a8abd6
commit ccf484c9bc
24 changed files with 205 additions and 74 deletions

View File

@ -132,6 +132,10 @@ class User(HashidMixin, UserMixin, db.Model):
def __repr__(self):
return f'<User {self.username}>'
@property
def is_administrator(self):
return self.can(Permission.ADMINISTRATE)
@property
def jsonpatch_path(self):
return f'/users/{self.hashid}'
@ -294,9 +298,6 @@ class User(HashidMixin, UserMixin, db.Model):
algorithm='HS256'
)
def is_administrator(self):
return self.can(Permission.ADMINISTRATE)
def ping(self):
self.last_seen = datetime.utcnow()