def link_to_acl(self, target, role: "roles.Permission") -> "RoleRelationship":
        """Creates a link between two YetiObjects.

        Args:
          target: The YetiObject to link to.
          role: The role to assign to the target.
        """
        # Avoid circular dependency
        from core.schemas.graph import RoleRelationship

        async_graph = self._db.graph("systemroles")

        aql = """
        WITH users, groups

        FOR v, e, p IN 1..1 OUTBOUND @extended_id
        acls
          FILTER v._id == @target_extended_id
        RETURN e"""
        args = {
            "extended_id": self.extended_id,
            "target_extended_id": target.extended_id,
        }
        neighbors = self._db.aql.execute(aql, bind_vars=args)
        if not neighbors.empty():
            neighbor = neighbors.pop()
            neighbor["__id"] = neighbor.pop("_key")
            relationship = RoleRelationship.load(neighbor)
            relationship.modified = datetime.datetime.now(datetime.timezone.utc)
            relationship.role = role
            edge = json.loads(relationship.model_dump_json())
            edge["_id"] = neighbor["_id"]
            job = async_graph.update_edge(edge)
            while job.status() != "done":
                time.sleep(ASYNC_JOB_WAIT_TIME)
            return relationship

        relationship = RoleRelationship(
            role=role,
            source=self.extended_id,
            target=target.extended_id,
            created=datetime.datetime.now(datetime.timezone.utc),
            modified=datetime.datetime.now(datetime.timezone.utc),
        )
        col = async_graph.edge_collection("acls")
        job = col.link(
            self.extended_id,
            target.extended_id,
            data=json.loads(relationship.model_dump_json()),
            return_new=True,
        )
        while job.status() != "done":
            time.sleep(ASYNC_JOB_WAIT_TIME)
        result = job.result()["new"]
        result["__id"] = result.pop("_key")
        return RoleRelationship.load(result)
Creates a link between two YetiObjects.

        Args:
          target: The YetiObject to link to.
          role: The role to assign to the target.
        
core/database_arango.py