Please explain how custom conditions work

System Information
  • Strapi Version: 4.3.8:
  • Operating System: Ubuntu:
  • Database: MySQL:
  • Node Version: 16.17.0:
  • NPM Version: 8.15.0:
  • Yarn Version: 1.22.18:

Here is the custom conditions explain how you can use them in enterprise edition.
Register custom conditions

There is no good example to understand how these work. For example I have collection type “wheat” where is one field name “price”. I want to show only those entries where price is greater than 50.

For this I’m using that condition.

const condition = {
  displayName: 'price greater than 50',
  name: 'price-gt-50',
  async handler(user) {
    return { price: { $gt: 50 } };
  },
};
  1. Create new role (wheat_user) with read, write, update, delete and for read add price condition
  2. Added new user with “wheat_user” role
  3. Open wheat content-type
  4. it says “You don’t have the permissions to access that content”

What I’m doing wrong. could you please explain how these conditions work