ProcessWire icon indicating copy to clipboard operation
ProcessWire copied to clipboard

PageTable under user template doesn't function.

Open Da-Fecto opened this issue 10 years ago • 7 comments

Non-superusers can't edit/create/delete pages from a PageTable field attached to the user template. (Superusers can)

The server response on the Ajax call from javascript is for superusers the expecting table Markup. The server response for non-superusers is the whole ProcessPageEdit form.

The ajax get URL's are identical for for both super and non-superusers. No data is save for the non-supperusers.

Arjen has the same issue.

Da-Fecto avatar Jun 24 '15 12:06 Da-Fecto

Thanks, I was able to duplicate and have just pushed a fix for this on the dev branch. Note that the user editing the PageTable will have to have page-edit/page-create access to the template being used for the PageTable, and page-add access to the parent used by the PageTable.

ryancramerdesign avatar Jun 29 '15 15:06 ryancramerdesign

Hi Ryan,

Thanks for your response. I updated to the latest dev and we're still having trouble regarding the PageTable. The server response is still the whole ProcessPageEdit form. I've checked:

  • The editor role has page-edit/page-create access for the template being used
  • The editor role has page-add access for the parent used by the PageTable

arjenblokzijl avatar Jul 05 '15 08:07 arjenblokzijl

Hi Ryan,

We investigated this further and double checked everything. We tracked it down a little futher to the editable() method in InputfieldPageTableAjax.php.

Whenever I disable that specific line (57) out the non-superuser can edit, add and delete pages from the PageTable field.

If you need access to the specific installation, please let me know. I can sent you those through a PM.

arjenblokzijl avatar Jul 20 '15 08:07 arjenblokzijl

@ryancramerdesign, so far I see this 'bug' is still there. We now rely on a dirty patch that disables the access checking which in my opinion is a bad thing. Also want to note that we are unable to update this install or we have to apply the dirty 'patch' again on newer versions.

Da-Fecto avatar Oct 19 '15 10:10 Da-Fecto

Disabling that $page->editable(); line isn't a safe thing to do, so I think we need to determine why Page::editable is returning false for the case you guys mentioned. I must not know how to duplicate it properly because I'm not seeing the issue here. Though make sure you are using the dev branch because the fix was applied there. The $page->editable(); on line 56/57 should actually be if(!$page->editable($field->name)) return; as it is on the dev branch. If you are already on the dev branch, do you have any other 3rd party modules hooking to Page::editable? @Da-Fecto you mentioned the issue was specific to the User template, but not clear if that's also the case for @arjenblokzijl. But if it is specific to the User template, the user would need to have user-admin permission (unless it's a user editing themselves in the profile editor?)

ryancramerdesign avatar Oct 19 '15 10:10 ryancramerdesign

Hi @ryancramerdesign,

I just installed a clean 2.7.0 latest master ProcessWire trying to describe the steps to reproduce. The problem seems to shift now since the modal window prints "The process returned no content.".

To confirm: we're just adding a PageTable field to the user template.

Here are the steps to reproduce:

Create an editor

  • Create role: editor
  • Assign page-edit + user-admin + page-lister permissions (without page-lister the admin page prints "The process returned no content.")
  • Create an user "editor" with the editor role and set password "editor123"

Create PageTable

  • Create a template "page_table" with only a title field
  • Create a pagetable field "page_table"
  • Assign the template "page_table" in tab Details
  • Set title=100 in the tab Input

Update user template

  • Assign "page_table" to the user template
  • Allow the user template to have children and select "page_table"
  • Allow editor on user template to: view, edit, create and add

Create a test-user

  • Add a new user "test_user"
  • Add a few Pages in the "page_table" field

Log-in as editor

  • Look for the "test_user" and try to create a new page in the "page_table" field
  • The modal window prints "The process returned no content.".

Double checking

Basic pages

  • Allow editor on home template to: view, edit, create and add
  • Assign field "page_table" to template basic-page
  • Try creating a new page and all works fine with regular pages

Change parent

  • Changing the parent (Select a parent for items) on the "page_table" field seems to save the page under the given parent, but the reference from the table field is lost on the user.

Hopefully you'll be able to reproduce. If you want access to this install please let me know. I can PM you all the details to get on the server.

Many thanks,

Arjen

arjenblokzijl avatar Nov 23 '15 20:11 arjenblokzijl

Hey Ryan,

I've tested again with 3.0.10 and 2.7.2 master. The issue changes a bit:

  1. The editor is now able to add the pages, but the PageTable isn't updated.
  2. A manual refresh (F5/CMD-R) after adding the page results in the page being seen, but only beneath the PageTable. The editor has to manually assign the page to the PageTable.

Please find a link to two clean installs (2.7.2 and 3.0.10) which both have the same issue. I've included a readme.md with the password to login.

arjenblokzijl avatar Mar 10 '16 09:03 arjenblokzijl