added migration script for users to add 'No access' roles in app_roles

This commit is contained in:
Davor 2022-06-10 16:43:10 +02:00
parent b6f3765a3a
commit c1e62089b6
2 changed files with 37 additions and 0 deletions

View file

@ -0,0 +1,12 @@
from .models import App, AppRole
class AppsService:
@staticmethod
def get_apps():
apps = App.query.all()
return [{"id": app.id, "name": app.name, "slug": app.slug} for app in apps]
@staticmethod
def get_app_roles():
app_roles = AppRole.query.all()
return [{"user_id": app_role.user_id, "app_id": app_role.app_id, "role_id": app_role.role_id} for app_role in app_roles]