Support » Plugin: Relevanssi - A Better Search » Gutenberg 403 wp-json/relevanssi/… as contributor

  • Resolved EdwardBock

    (@edwardbock)


    Hi there,

    when I use the Gutenberg editor with a user that has the role of a contributor they get the relevanssi sidebar but something seems to go wrong because the network request infos show that three requests are forbidden:

    – /wp-json/relevanssi/v1/sees/123?_locale=user
    – /wp-json/relevanssi/v1/listrelated/123?_locale=user
    – /wp-json/relevanssi/v1/listexcluded/123?_locale=user

    Thanks in advance
    Edward

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Indeed, there’s a bit of a permission mismatch here. The Relevanssi sidebar is displayed to all users with edit access, but the REST API endpoints require manage_options capability.

    This can be fixed with this snippet:

    add_filter( 'relevanssi_options_capability', function() { return 'edit_posts'; } );

    However, this has the side-effect of opening Relevanssi settings to contributors, which may or may not be a problem.

    Do you think contributors should have access to the Relevanssi sidebar in the first place? I’m not sure what is the best default solution here, but clearly the permissions here must match. I’ll fix this somehow in the next version, but input on what’s the best default solution would be welcome.

    Thread Starter EdwardBock

    (@edwardbock)

    Thanks for the quick fix snippet.

    Good questions if contibutors should have the permission. I don’t really know. Maybe it would be the best to have an option in relevanssi settings where it’s possible to specify for which roles or permission level the relevanssi sidebar should be available in the gutenberg editor. This solution would be the most flexible I guess.

    Plugin Author Mikko Saari

    (@msaari)

    I’ve been thinking about this, and I think contributors probably shouldn’t have access to the Relevanssi settings panel. At least in the sites I run, adjusting Relevanssi settings for the post is something I don’t want contributors doing. So I think I’ll make it default setting that only editors see the sidebar in the first place, and make it adjustable so that it’s separate from the overall Relevanssi settings.

    Thanks for bringing this up.

    Thread Starter EdwardBock

    (@edwardbock)

    Sounds great!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.