def initialize_default_resources_admin(): """Initializes the default resources for an admin user""" admin = Role.query.filter(Role.id == 3).first() if not admin: admin = Role("admin", description="Placeholder description", resources=default_resource_permissions_admin) db.session.add(admin) else: admin.set_resources(default_resource_permissions_admin) db.session.commit()
def initialize_default_resources_guest(): """Initializes the default resources for a guest user""" guest = Role.query.filter(Role.name == "guest").first() if not guest: guest = Role("guest", resources=default_resource_permissions_guest) db.session.add(guest) else: guest.set_resources(default_resource_permissions_guest) db.session.commit()
def initialize_default_resources_internal_user(): """Initializes the default resources for an internal user""" internal_user = Role.query.filter(Role.id == 1).first() if not internal_user: internal_user = Role("internal_user", description="Placeholder description", resources=default_resource_permissions_internal_user) db.session.add(internal_user) else: internal_user.set_resources(default_resource_permissions_internal_user) db.session.commit()
def initialize_default_resources_workflow_operator(): """Initializes the default resources for a guest user""" workflow_operator = Role.query.filter(Role.name == "workflow_operator").first() if not workflow_operator: workflow_operator = Role("workflow_operator", description="Placeholder description", resources=default_resource_permissions_workflow_operator) db.session.add(workflow_operator) else: workflow_operator.set_resources(default_resource_permissions_workflow_operator) db.session.commit()
def initialize_default_resources_workflow_developer(): """Initializes the default resources for a workflow developer""" workflow_developer = Role.query.filter(Role.id == 5).first() if not workflow_developer: workflow_developer = Role("workflow_developer", description="Placeholder description", resources=default_resource_permissions_workflow_developer) db.session.add(workflow_developer) else: workflow_developer.set_resources(default_resource_permissions_workflow_developer) db.session.commit()
def initialize_default_resources_app_developer(): """Initializes the default resources for an app developer""" app_developer = Role.query.filter(Role.id == 4).first() if not app_developer: app_developer = Role("app_developer", description="Placeholder description", resources=default_resource_permissions_app_developer) db.session.add(app_developer) else: app_developer.set_resources(default_resource_permissions_app_developer) db.session.commit()