Jump to content

Page Reference field problem with custom role permissions


LMD
 Share

Recommended Posts

I'm experiencing an issue with the page reference field-type (FieldtypePage) when I set the "page-edit-created" permission for a custom role on the template of the pages being referenced.

I'm using ProcessWire 3.0.28 devns with the default admin theme (on my local XAMPP set-up).

This is what's happening:

I have a list of comics and genres ("categories") which reside in the page tree under the home page:

  • Home
    • Comics [parent: comics_archives]
      • Comic #1 [child: comics_single]
      • Comic #2
      • Etc...
    • Genres [parent: comics_genres]
      • Genre Title #1 [child: comics_genre_single]
      • Genre Title #2
      • Etc...

On the comics template (comics_single) there is a page reference field to select genres.

The page reference field has the following settings:

  • Details Tab
    • Multiple Pages: PageArray
  • Input Tab
    • Selectable Pages:
      • Parent: Genres
      • Template: comics_genre_single
    • Label: Title (default)
    • Input Type: AsmSelect
    • Link selected pages to page editor: No.
    • Allow new pages to be created from field: Yes (checked)

I do not have any special "Access" permissions assigned to the field itself.

I have a custom role ("bcn-author" -- * see end of post for permission settings for role) that is allowed to View/Edit/Create new genres. The templates have the following "Access" settings:

comics_genres: View Pages / Add Children (no need to Edit this page)

pwcapture-template_comic_genres.png

comics_genre_single: View Pages / Edit Pages / Create Pages

pwcapture-template_comic_genre_single.png

When using the page field while logged-in as a user with the custom-role assigned, it works as it should.  There is a "Create New" link on the page field in the comics template and the user can add new genres (it also works as expected in the page tree view).

However, my problem arises when I assign the "page-edit-created" permission for the custom role under "Additional edit permissions and overrides" on the "comics_genre_single" template.

Then, the "Create New" link disappears on the page reference field on the comics template (they can still add existing genres). Although it is still possible to add new genre pages from the page tree; so it seems to be just related to the page reference field (FieldtypePage).

I'm trying to set this permission because I do not want users to be able to edit genres once they have been created -- I can not find this as an option though (you can not check "Create Pages" without "Edit Pages" also being checked on the "Access" tab), so I thought limiting user's ability to edit to just their own genres pages would be a compromise.

Also, I'm successfully using the "page-edit-created" permission on the comics templates, so it doesn't seem to be related to the permission by itself.

It's puzzling me -- have I overlooked something obvious, or is this actually correct behaviour and I've misunderstood something?

~ LMD

* Permissions settings for "bcn-author" custom role (note: screenshot was taken after I had _removed_ the "page-edit-created" permission from "comics_genre_single" template, so it does not show here).

pwcapture-custom_role_perms.png

Link to comment
Share on other sites

  • 1 year later...

This is still unfixed. I ran into this exact same issue under ProcessWire 3.0.98.

I would start looking somewhere around here: InputfieldPage.module @github line 437 but I haven't got very far in making sense of it all.

https://github.com/ryancramerdesign/ProcessWire/blob/a210ba0b5ea67e56fef8a27a620bcfa6f96ca0b8/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module#L437
Link to comment
Share on other sites

18 hours ago, adrian said:

Not sure if this is the issue or not, but in your selector for the Page Reference field please try adding: access=0

Tried it, but does not seem to do anything. I can still add new pages from the Page List, but not via the Page Reference field (Page Auto Complete in my case, but same with all other input field types).

What is this selector supposed to do?

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...