Jump to content

Admin Search - no unplubished Pages can be searched


Erik Richter
 Share

Recommended Posts

Hey folks,

If I search for a page that is unpublished it can not be found by using the ajax search in the right corner in admin. 

It can only be found when I am logged in as a Superuser, but not if I am logged in as an Editor (who has page-edit rights!). 

Searching through lister works - but only if I choose to only search unpublished pages; but not via the ajax search at all.

I already looked at the process page search module file and there is a line that allows unpublished pages to be searched if someone has paeg-edit rights, but somehow it does not work at all.

Can someone help?

Thank you so much!

  • Like 4
Link to comment
Share on other sites

  • 1 month later...

I would like to take issue with this as well. It’s awkward for non-superusers not to find pages (or other users) they can otherwise reach, and I don’t really see why this restriction is in place by default. It is also not easy to implement a hook to change this behavior, which would be trivial to do the other way around.

I.e. if the “include” parameter weren’t overridden by the Process function, that feature could be retrofitted like so:

wire()->addHookBefore('ProcessPageSearch::executeFor', function($event) {
    if(!$this->user->isSuperuser())
        wire()->input->get->include = 'hidden';
});

As well as any other custom restrictions one might need to respect custom roles and permissions.

However, as it is now the restriction is hardcoded into the function and I’m not sure how to modify it in a non-destructive manner.

Are there security reasons for the way it’s currently done?

  • Like 6
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...