Jump to content

You don't have access to list page /


MarkE
 Share

Recommended Posts

For some reason no users other than superusers can see the page tree on a site. The message is "You don't have access to list page /"

That seems to imply they don't have access to the home page, but looking at the access to the home page, there are no restrictions.

Any ideas?

Link to comment
Share on other sites

I'm not sure that there is an obvious answer to this as it seems to be related to a bunch of other inexplicable problems I have been having which are peculiar to my live envronment. See my comments here.

Link to comment
Share on other sites

  • 3 weeks later...
On 5/21/2024 at 12:21 AM, MarkE said:

For some reason no users other than superusers can see the page tree on a site. The message is "You don't have access to list page /"

That seems to imply they don't have access to the home page, but looking at the access to the home page, there are no restrictions.

Any ideas?







Any update? As a student, I can say that ukwritings https://ukwritings.com/essay-services has been a game-changer for me during my university journey. Their essay services are thorough and reliable, ensuring each paper meets high academic standards. I've received consistent support and top-notch quality, making them an indispensable part of my academic success. Whether it's research papers or critical analyses, UK Writings delivers excellence every time.

Any update?

Edited by JimmyPrice
Link to comment
Share on other sites

On 6/10/2024 at 8:32 AM, JimmyPrice said:

Any update?

The problem is caused by moving all my ready.php into a module ready(), which works in the dev environment, but not in live. See my second post. I'm still working on this one!

Link to comment
Share on other sites

I have now looked into this in more depth and am even more puzzled.

In ready.php, I have two hooks:

wire()->addHookBefore('ProcessPageList::execute', function(HookEvent $event) {
	$process = $event->object;
	$listable = $process->page->listable;
	bd([$process->page, $listable], 'page, listable');
	if(!$listable) bd(debug_backtrace(), 'backtrace not listable');
});

wire()->addHookAfter('Page::listable', function(HookEvent $event) {
	$event->return = true;
	bd($event->return, 'listable return');
});

In the dev environment, this always yields the correct result, regardless of whether the hooks are called from /site/ready.php or my module ready():

1090367850_Screenshot2024-06-14105839.png.c37182b18a7f5818bda0424550b646c4.png

In the live environment, the result is correct only if the hooks are called from /site/ready.php. If the hooks are called from my module ready(), the result is:

2125362591_Screenshot2024-06-14110158.png.d717947aac574ad13f9e395727533682.png

Link to comment
Share on other sites

4 hours ago, BrendonKoz said:

Does it have the same end result if, on your dev environment, you have debug disabled?

Yes - it makes no difference.

On the dev site, I can track exactly what happens by stepping through with Xdebug. The only code between the two bardumps is a couple of WireData 'gets' for 'return' returning true. It would be great to be able to do the same in the live environment!

  • Sad 1
Link to comment
Share on other sites

When I was adjusting the Page's editable, listable, viewable, and addable method hooks, I was testing access for one to determine access to another. This caused a bit of a recursively confusing mess. You aren't by chance doing something similar, are you? If so, different calls of the same method can/will return different values due to context, and data that either is, or hasn't yet been set (typically access to templates in my case).

  • Like 1
Link to comment
Share on other sites

4 hours ago, BrendonKoz said:

You aren't by chance doing something similar, are you?

Interesting thought. I have a hook on viewable within a hook on ProcessPageEdit::buildFormContent. I also have a hook after User::hasPagePermission. I tried removing them temporarily and it made no difference.

Link to comment
Share on other sites

SOLVED!

With many thanks to @BrendonKoz and @flydev for encouraging me to persist in tracking this down. I finally managed to get the error to occur in the dev environment. That was progress as it enabled me to use Xdebug to see what was happening. I found another module with a listable hook in ready().

What was happening was this:

When my hook was in /site/ready.php it ran after any hooks in modules' ready(), because that is the order ProcessWire calls them in. When I put my hook in my module's ready() it still ran after the other module's hook in the dev environment but before it in the live environment. Assigning a higher priority to my hook (1000 - i.e. greater than the default 100) fixed it.

  • Like 1
Link to comment
Share on other sites

It doesn't break, or negatively affect the other module now, does it? 🤞 You've been struggling with this for awhile - glad you've made significant progress (and maybe completely solved it)! flydev definitely deserves the credit aside from yourself though, imho. 😅

Link to comment
Share on other sites

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

  • Recently Browsing   0 members

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