pressbooks icon indicating copy to clipboard operation
pressbooks copied to clipboard

While a regular user isn't present in the root site user list, they are directed to, but prevented from viewing wp/wp-admin/index.php?page=pb_home_page

Open tw77 opened this issue 11 months ago • 3 comments

Update: this only affects regular users immediately after they're removed from the root site user list (while remaining in the overall network user list), before they sign out and back in. It seems that when a regular user signs in again from the network home page, they're automatically added to the root site user list as a Subscriber.

As a regular/lowly user who doesn't belong to the root site user list, I'm limited to viewing dashboards for books I've created. I can't reach wp/wp-admin/index.php?page=pb_home_page and I see this message instead:

Screenshot 2024-03-07 at 9.07.36 AM.png

wp/wp-admin/index.php?page=pb_home_page is also linked in the 'My Books' text in the top nav of a book dashboard and leads regular users to the same message about lacking privileges.

Screenshot 2024-03-07 at 9.09.54 AM.png

tw77 avatar Mar 07 '24 17:03 tw77

Update: this seems to only affect regular users immediately after they're removed from the root site user list. It appears to be resolved after a brief period of time, logging out and back in again. But it's only resolved because the user is automatically added back to the root site user list as a Subscriber upon sign in, which seems unexpected.

tw77 avatar Mar 07 '24 17:03 tw77

I think @richard015ar may know more about this than I do -- but I believe that we added something a few years ago that adds users to the root site with the subscriber role in order to fix some problem we were having with what we called 'lowly users'. I don't remember details at this time. We'd have to look it up.

SteelWagstaff avatar Mar 13 '24 17:03 SteelWagstaff

I am trying to remember the background of this. I think this PR: https://github.com/pressbooks/pressbooks/pull/2269/, it seems that the dashboard requires at least 1 role in the network: https://github.com/pressbooks/pressbooks/pull/2269/files#diff-26033bae1c0a0fc078e299cf5e544aa6af1dbfa964e4fd7ba634c6bed73905d1R62 And, when a user is updated or created, the updated hook is called and it seems that it adds the subscriber role to the main site if the user does not have any role at all: https://github.com/pressbooks/pressbooks/pull/2269/files#diff-fac5c1023fd51cab8a4531054fdc4920a1c6c23b6c5386e2f3f4f401afa7c59eR446

It might be because the clone page at that point was only available at the book level. I think there is another PR that adds the clone page at the network level, so maybe we don't need to check for the user role anymore to add the page, we just add it at the network level in any case.

richard015ar avatar Mar 13 '24 18:03 richard015ar