getgrav / grav-plugin-simplesearch

Grav SimpleSearch Plugin
https://getgrav.org
MIT License
44 stars 55 forks source link

Added check for ACL in Header of pages when searching #102

Closed NilsEngelbach closed 7 years ago

NilsEngelbach commented 7 years ago

The SimpleSearch Plugin returns results for pages that are protected by ACL Rules like

access:
    site.login: true

It is not enough to filter the results in the twig template for search results, since there is also an json formatted endpoint (/search.json/query:Example).

rbukovansky commented 7 years ago

@flaviocopes Can we please get this merged ASAP and release of new version of this plugin done? Thank you very much.

NilsEngelbach commented 7 years ago

@rbukovansky I am not really into PHP and grav plugins yet, so you might want to improve/refactor the code. I think there could be couple of improvements, especially for the more less duplicated code from login plugin. Maybe there should be a general function to do this filtering in the "core?!", if this would be possible...

rbukovansky commented 7 years ago

@NilsEngelbach Well, I'm not a dev at all... I've just asked @flaviocopes to merge the changes and please to do a proper release... That's all.

flaviocopes commented 7 years ago

Looks good, thanks!

lulis commented 7 years ago

Hi, This patch breaks my simplesearch usage, now i got the following error (on this line):

Identifier "user" is not defined.

I'm not using any kind of login in grav. Have to comment the call of checkForPermissions (here) as workaround.