Editor role cannot edit Single Types

It should be yes using conditionals, the documentation for that isn’t released yet but I can provide the prototype here (this may be subject to change when we release I18N):

Using RBAC conditions

:warning: Warning

This API is considerred unstable for now

Adding a new condition


In your bootstrap file located in ./config/functions/bootstrap.js you can do the following:

const conditions = [
  {
    displayName: "Entity has same name as user",
    name: "same-name-as-user",
    plugin: "name of a plugin if created in a plugin"
    handler: (user) => {
      return { name: user.name };
    },
  },
];
​
module.exports = () => {
  // do your boostrap
​
  strapi.admin.services.permission.conditionProvider.registerMany(conditions);
};

Condition


A condition have 4 possible properties:

  • displayName: name showed in the UI
  • name: technical name. Should be kebab-cased
  • plugin: If you create a plugin condition add the plugin name. e.g content-manager
  • handler: A function (sync or async) that returns a condition object. Read more here

Handler


The condition handler receives the authenticated user making the request.

It should return oneOf:

  • true:

    Returning true means the condition will always match.
    It is usefull if you want to verify an external condition or a condition on the authenticated user only.
    const condition = {
      displayName: "Can drink",
      name: "can-drink",
      async handler(user) {
        if (user.age > 21) return true;
        return false;
      },
    };
    

  • false:

    Returning false means the condition will never match.
    It is usefull if you want to verify an external condition or a condition on the authenticated user only.
    const condition = {
      displayName: "Can drink",
      name: "can-drink",
      async handler(user) {
        if (user.age < 21) return false;
        return true;
      },
    };
    

  • Condition object:

    A condition obect is an matcher object that will allow verify conditions on the entities you read, create, update or delete.

    We use sift.js behind the scenes to do the condition matching. Here are the list of allowed operators:
    • $or
    • $eq
    • $ne
    • $in
    • $nin
    • $lt
    • $lte
    • $gt
    • $gte
    • $exists
    • $elemMatch

      Examples
    const condition = {
      displayName: "price greater than 50",
      name: "pricate-gt-50",
      async handler(user) {
        return { price: { $gt: 50 } };
      },
    };