Jump to content

Recommended Posts

Posted

I have a number of pages which host dependent select fields. The contents of these are drawn from various repeater fields (actually repeaterMatrix, but I don't think that's relevant to the problem) - i.e. they are provided by a selector which is something like "template=repeater_field_name, ...". They all work fine in superuser, but in any non-superuser role, they return an empty result, even if the role has the maximum permissions. It seems like every repeater template needs to specifically permit access to the required roles, because they are all children of 'admin'.

Is this so? Is there a shortcut way of doing this (there are a lot of such fields)?

Edit: I guess what I would like to do is to set the access to the repeater page to be the same its host page (getForPage) rather than admin. Any ideas?

Posted

Thanks @AndZyk. I had tried check_access, but it didn't work. I found out why - because ProcessPageSearch contains the following:

			// don't allow setting of check_access property, except for superuser
			if($lowerName == 'check_access' && !$superuser) continue; 

So I sort-of hacked it with a hook:

wire()->addHookAfter('ProcessPageSearch::findReady', function(HookEvent $event) {
	$selector = $event->return;
	$user = wire()->users->getCurrentUser();
	if($user->hasRole('webmaster')) $selector = 'check_access=0, ' . $selector;
	$event->return = $selector;
});

which works, but I'm not very happy with it!

  • Like 1
Posted

I was referring to the selector string options of a page field under the input tab.

1709883391_Bildschirmfoto2022-09-06um12_06.thumb.png.0241af0ed0393300547ae5c9c50ed64a.png

If your case is more complicated than that, sorry I don't think I can help you. ?

  • Like 1
Posted

Thanks @AndZyk. I am using dependent selects. So it needs check_access=0 in the input tab as you suggest for InputfieldPage to get it. However for dependent selects, ProcessPageSearch is called to populate the options and strips out the 'check_access'. Then, when the options don't include the already-selected item provided by InputfieldPage, it is removed ?

I think perhaps I should raise this as an issue or feature request.

  • Like 2
Posted
On 9/6/2022 at 11:16 AM, MarkE said:

I think perhaps I should raise this as an issue or feature request

Actually, I am building a little module to fix it, hopefully ? -Edit: You can now find it here.

  • Like 1

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...