RBAC Conditions not Working

System Information
  • Strapi Version: 4.12.0
  • Operating System:
  • Database: sqlite
  • Node Version: 18
  • NPM Version:
  • Yarn Version:

I am trying to set a condition such that a field can only be updated by a staff which is a relation field with the admin user or if the field is empty. I tested the relation field logic but it is not working. I do not know what is wrong

    const conditions = [
      {
        displayName: "Order editable by linked staff or if unlinked",
        name: "order-editable-by-linked-staff-or-if-unlinked",
        async handler(user) {
          return {
            $or: [{ staff: { $eq: user.id } }, { staff: { $exists: false } }],
          };
        },
      },
    ];