Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Apply RBAC Custom Conditions in Navigation Plugin #389

Open
bobbylipps opened this issue Oct 18, 2023 · 4 comments
Open

Unable to Apply RBAC Custom Conditions in Navigation Plugin #389

bobbylipps opened this issue Oct 18, 2023 · 4 comments
Labels
backlog enhancement New feature or request feature request Community feature request v4 Strapi v4

Comments

@bobbylipps
Copy link

bobbylipps commented Oct 18, 2023

Description:
I'm attempting to implement custom conditions within the Navigation plugin to restrict certain menus based on user roles. Specifically, I want to limit the menus an editor can access and modify.

I added the following custom condition in src/index.js:

const docsNavigation = {
  displayName: "Can only view docs navigation",
  name: "docs-nav-access",
  async handler(user) {
    const condition = { id: { $eq: 3 } };
    return condition;
  }
};

await strapi.admin.services.permission.conditionProvider.register(docsNavigation);

I tried applying the custom condition using various field names such as id, name, slug, etc. I navigated to the navigation editing page at /admin/plugins/navigation and can still see all menus. The custom condition is applied to the role in the Strapi admin.

Expected Behavior:
The custom condition should limit the visibility and editability of menus based on the specified condition.

Actual Behavior:
The custom condition doesn't seem to have any effect on the navigation editing page. No matter which field name I use, the condition doesn't seem to apply.

Additional Information:

  • I'm trying to achieve a scenario where editors only have access to specific menus.
  • I'm unsure if the Navigation plugin supports these custom conditions or if I'm missing something in my implementation.

Any guidance or clarification on whether the Navigation plugin supports such custom conditions would be greatly appreciated.

strapi - 4.15.0
strapi-plugin-navigation - latest

@TasosBak
Copy link

Could you share which strapi/plugin versions you are using?

@bobbylipps
Copy link
Author

Thanks for the reply.

strapi - 4.14.2
strapi-plugin-navigation - latest

Do you need anything else?

@TasosBak
Copy link

I don't know if I will be able to help but the versions you are using is important info for anyone that will try to help.

@cyp3rius
Copy link
Contributor

cyp3rius commented Jan 5, 2024

In regard to applying custom roles to the admin endpoints filtering - there is no built-in support. But your case looks interesting and I think we might consider to put it into the backlog.

@cyp3rius cyp3rius added enhancement New feature or request feature request Community feature request backlog v4 Strapi v4 labels Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog enhancement New feature or request feature request Community feature request v4 Strapi v4
Projects
None yet
Development

No branches or pull requests

3 participants