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 a.masca
      Goodmorning everyone,
      sorry for the inconvenience but I have a problem that I can't find in any other post.
      Strange things happen on a site:
      - despite everything being configured correctly (as already done in dozens of other sites) only superusers can create new pages
      - if I insert in a selector "include = all" the result is always 0
      - I should restore a series of pages incorrectly inserted in the trash, but I cannot select them with the selector "status = Trash"
      Some idea?
      Thanks so much for your valuable support.
    • By LAPS
      According to this old post, I'm trying to use the PW cache feature:
      $my_page = $pages->get($pageId); if($my_page->viewable()) { $content = $cache->get("my_page"); if(!$content) { $content = renderCustom($my_page->children); $cache->save('my_page', $content, 3600); } echo $content; } function renderCustom(PageArray $items) { foreach($items as $item) { echo $item->title; // ... heavy content loading } } After loading the page which renders the above code, in the admin I can see something was cached (note: I'm using ClearCacheAdmin) :

      But when I reload the page the cached value seems do not be used and the page loads slowly.
      The result of doing var_dump() is the following:
      var_dump($cache); // return object(ProcessWire\WireCache)#20 (0) { } $content = $cache->get("my_page"); var_dump($content); // return string(0) ""  
      What could be the problem?
    • By LAPS
      Can you confirm that the function renderField for fieldset fields, even having the file /site/templates/fields/fieldName.php or /site/templates/fields/fieldName/$file.php (using $file argument), does not render anything as expected?
      $page->renderField('fieldsetName') // returns nothing ... or am I wrong on something?
    • By LAPS
      Hi there,
      I'm working on an email message template and would like to render a custom one to be sent.
      I tried to use $files->render() this way
      // rendering file e.g. a template file or a hook statement in ready.php $body = $files->render('emails/myfile', array( 'myVar1' => $var1, 'myVar2' => $var2, ... )); but $vars seems to be not accessible from within the rendered file. That is, $vars seems to be not set:
      // rendered file emails/myfile.php $myVar1 = $vars['myVar1']; // is not set $myVar2 = $vars['myVar2']; // is not set ... // is not set How can I get the $vars so to properly render the custom message template for sending the email?
       
      Notes:
      By using $files->include() the $vars is accessible but I cannot use this method because I should retrieve the output $body as a return value for sending the email later. So, I'm still looking to render the custom message using $files->render(). This thread is someway related to this one.
    • By MarkE
      Having just wasted the best part of a day debugging an access issue because I hadn't realised that page-edit-created negated any related page-edit permissions, could I suggest that a note to this effect is included in the default title. I have amended the title on my system to read:
      Edit only pages user has created (IMPORTANT: This will negate any related page-edit permission - including permissions granted to a user by other roles) ..although it may be possible to make it briefer while not losing clarity and impact.
×
×
  • Create New...