Jump to content
pwFoo

Custom permissions page-delete-own and page-edit-own

Recommended Posts

Hi,

I try to add page-edit-own and page-delete-own permissions, but it's strange...

If a add the custom permissions it looks like both are children of page-edit respectively page-delete. I played with added / revoked permissions, but I can't get it work, that a user of a role just can delete own content.
First the user can't delete any content and now the user can delete own and foreign pages 🤪

Is there a tutorial to learn more about the PW permissions?
Or do I have to rename the permissions to page-own-edit and page-own-delete to be independent from page-edit and page-delete?

Share this post


Link to post
Share on other sites

Thanks! Tested the permissions, but have a problem with permissions or understanding how it works.
"page-create" is activated for "basic-page". Don't know if needed... just activated to test...

My role has the following permissions set.

image.thumb.png.1ae081b9e48745edccbd57d9b81293bd.png

 

Tried to add a page to home ("/") with template ""basic-page".

Do some permission check before...

Page owner: test
Current user: test
Current user roles: guest, writer
Current user permissions: page-view, page-edit  // --> missing allowed permissions "page-edit-created, page-edit-trash-created"
Addable (parent): 0         // --> 1 (allowed to add child to "/")
Addable (child to page): 0  // --> OK, add to parent should work, not add children to that page
Editable: 1                 // --> OK, but by page-edit or as should page-edit-created???
Trashable: 0                // --> 1 (allowed by page-edit-trash-created)
Deleteable: 0               // --> OK, just allowed to trash the page...

User test has role "writer" (screenshot with permissions), is page owner(!). Added expected values to the permission check output above.

Checked by addable(), editable(), trashable() and deleteable() methods.

Share this post


Link to post
Share on other sites

Hi @gmclelland,

strange... Image isn't broken here, but I changed the post a short time later because I fixed it... The changes are gone, just the "solved" tag is there.

Problem was that the page was moved to trash and so parent wasn't home ("/") anymore. So different permissions and trashable == false was "fine". I moved the page back and all looks good.

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Pip
      Hi everyone!
      I'm trying out the Login/Register module for my site. Noted that the module assigns the newly registered user to login-register role. 
      Once you modify the login-register role's permissions, particularly adding page-edit, the new member role will be set to guest. 
      Thing is I'd like to grant my new users the power to create their own pages. Any advice? 
      Thanks. 
    • By Sten
      Sorry I can't find any submit button to save my configuration on a template in the admin interface. The file is fine.
    • By nabo
      Hello
      this is my snippet
      public function init() { if($this->wire('user')->isSuperuser()) { $this->wire()->addHookAfter('ProcessPageEdit::buildFormSettings', $this, 'buildForm'); $this->wire()->addHookBefore('ProcessPageEdit::processInput', $this, 'saveForm'); } } public function buildForm(HookEvent $event) { $p = $event->object->getPage(); $inputfields = $event->return; $fieldset = $this->wire('modules')->get("InputfieldFieldset"); $fieldset->attr('id', 'my_fieldset'); $fieldset->label = __("My Renders"); $fieldset->collapsed = Inputfield::collapsedYes; $field = $this->wire('modules')->get("InputfieldTextarea"); $field->attr('name', 'renders'); $field->attr('value', $p->renders); $field->label = $this->_('Renders'); $fieldset->append($field); $inputfields->append($fieldset); } public function saveForm($event) { $page = $this->pages->get($this->input->post->id); $page->set('renders', $this->input->post->renders); } It builds correctly the inputs, I edit the field renders but when I save the page the value of this inputfield remain blank.
      What's wrong?
    • By carlitoselmago
      I'm building a fieldtype/inputfield to visually select a grid like Bootstrap since it's the first time coding such thing, I'm basing my code in FieldtypeColorPicker since the base structure is the same, a graphical UI helper to finally output a string as value.
      The problem is I try to save the value as something like "1,2,3" referencing the index of each column selected but it gets converted as an int value so "1,2,3" becomes "1" if input random text it gets converted as "0".
      Here is the code:
      https://github.com/carlitoselmago/FieldtypeGridSpace
      Here's an screenshot of how it looks

    • By snck
      Hey,
      I want my editors to be able to use the page lister, especially the bookmarks. I added the page-lister permission to the editor role, but Page lister ("Find" menu item) does not show. Is there anything else I have to do? Links to bookmarks work for the editors, but I would be glad to show them the menu item as well.
      Maybe this has something to do with the long history of the site (started with ProcessWire 2.4 and upgraded to 3.0.148 over the years)?
      Thanks,
      Flo 
×
×
  • Create New...