def wrapper_check_role_auth(*args, **kwargs):
        blueprint_id = kwargs.get("blueprint_id")
        if not blueprint_id:
            return f"Authorization configuration error", 401

        version_id = kwargs.get("version_id")
        if not PostgreSQL.version_exists(blueprint_id, version_id) and not CSAR_db.version_exists(blueprint_id,
                                                                                                  version_id):
            return f"Did not find blueprint with id: {blueprint_id} and version_id: {version_id or 'any'}", 404

        project_domain = PostgreSQL.get_project_domain(blueprint_id)
        if project_domain and not check_roles(project_domain):
            return f"Unauthorized request for project: {project_domain}", 401

        return func(*args, **kwargs)
    def wrapper_check_role_auth(*args, **kwargs):
        deployment_id = kwargs.get("deployment_id")
        if not deployment_id:
            return f"Authorization configuration error", 401

        inv = PostgreSQL.get_deployment_status(deployment_id)
        if not inv:
            return f"Deployment with id: {deployment_id} does not exist", 404

        if not PostgreSQL.version_exists(inv.blueprint_id, inv.version_id) and not CSAR_db.version_exists(
                inv.blueprint_id, inv.version_id):
            return f"Did not find blueprint with id: {inv.blueprint_id} and version_id: {inv.version_id or 'any'}", 404

        project_domain = PostgreSQL.get_project_domain(inv.blueprint_id)
        if project_domain and not check_roles(project_domain):
            return f"Unauthorized request for project: {project_domain}", 401

        return func(*args, **kwargs)