apeisa / UserGroups

Adds users groups and page based permission to ProcessWire
GNU General Public License v2.0
11 stars 4 forks source link

Issue with repeaters #18

Closed teppokoivula closed 10 years ago

teppokoivula commented 10 years ago

Call to $page->highlights (repeater field) returned no results and after some digging this is what I've found:

FieldtypeRepeater ___wakeupValue() seems to have working selector 'parent_id=1054, templates_id=52, sort=sort, check_access=0' (at least when tested with selector test this returns expected results) but following query fails:

// load the repeater pages
$a = wire('pages')->find($selector);

$a is PageArray, but $a->count() returns 0, while in this particular case it should contain 5 items (Pages). I don't have the time right now to debug this further, but might take another look later..

niklaka commented 10 years ago

We're hooking find() and adding "view_groups|inherit_access.view_groups=123|234" to the selector. Selector shouldn't be messed around with when fetching repeater pages (or user groups - same bug there for non-superusers). I'll try and find a way around this.

There's always the possibility to take the lower level route and hook PageFinder::getQueryAllowedTemplates() (and maybe something else as well) instead of find() but let's see if that can be avoided.

niklaka commented 10 years ago

Not a pretty fix (had to match "check_access=0" in the selector string), but does the trick for now.

Turns out that user groups not being shown to a non-superuser with proper permissions is whole another bug. I'll create a new issue on that.