Correct tenant in session using to_dict

This commit is contained in:
Josako
2024-04-30 15:08:04 +02:00
parent 9faf5a9fc0
commit 8e069cc653
4 changed files with 23 additions and 7 deletions

View File

@@ -28,6 +28,16 @@ class Tenant(db.Model):
def __repr__(self):
return '<Tenant %r>' % self.name
def to_dict(self):
return {
'id': self.id,
'name': self.name,
'website': self.website,
'license_start_date': self.license_start_date,
'license_end_date': self.license_end_date,
'allowed_monthly_interactions': self.allowed_monthly_interactions
}
class Role(db.Model, RoleMixin):
__bind_key__ = 'public'
@@ -85,4 +95,3 @@ class User(db.Model, UserMixin):
def has_roles(self, *args):
return any(role.name in args for role in self.roles)