Jump to content


Photo

Enabling ability to access trash for a Role

permissions users

  • Please log in to reply
4 replies to this topic

#1 evanmcd

evanmcd

    Full Member

  • Members
  • PipPipPip
  • 82 posts
  • 28

Posted 28 June 2012 - 02:54 PM

Hi all,

Does anyone know of a way to create a Role that can be given access to the Trash?

In normal circumstances, I agree with Ryan's decision to allow it only to Superusers, however I'm using PW as a the admin for a contest app on Facebook, and I need the company we have handling moderation of the submissions to be able to access the Trash.

Any ideas welcome!

Thanks.

#2 Soma

Soma

    Hero Member

  • Moderators
  • 3,205 posts
  • 1757

  • LocationSH, Switzerland

Posted 28 June 2012 - 03:00 PM

You don't want to give access to the trash, it's a dark and dangerous stinky place.

@somartist | modules created | support me, flattr my work flattr.com


#3 diogo

diogo

    Hero Member

  • Moderators
  • 2,008 posts
  • 1089

  • LocationPorto, Portugal

Posted 28 June 2012 - 03:58 PM

We don't want people to have access to the trash so they can't irresponsibility delete some important thing, right? What about giving them access only to recover things?

#4 ryan

ryan

    Hero Member

  • Administrators
  • 5,780 posts
  • 3124

  • LocationAtlanta, GA

Posted 29 June 2012 - 02:59 PM

It's not possible at present to give other roles access to the trash. That is an area where access inheritance doesn't exist (since it's an anything-goes bucket 'o trash). It becomes a can of worms when considered in light of access control. Do you really want someone digging in your trash? :)

A couple of alternatives:

1. Consider that /trash/ is just a page with children (albeit a smelly one). But you can just as easily make your own trash page. Rather than deleting pages, ask them to change the parent to your trash page (or drag their page into it). So long as they have access, they should be able to drag stuff in and out of it. If they pages they are dragging into it use templates that inherit access, and you make your trash page not viewable to guest, then any pages dragged into it are essentially removed from the site.

2. It sounds like you might be using trash as an unpublished area. If that's the case, I recommend just using PW's Unpublished status rather than the trash.

3. If you still want to use PW's system trash, you can create a template or module that lets them undelete stuff they've deleted. This isn't complete, but gives the basic idea:

$deletedPages = $pages->get('/trash/')->find("modified_users_id=$user, include=all"); 

if(count($input->post->restore)) {
  $parent = $pages->get('/some/parent/'); 
  foreach($deletedPages as $p) {
    if(in_array($p->id, $input->post->restore)) {
      $p->parent = $parent; 
      $p->save();
      echo "<li>Restored: {$p->url}</li>";
    }
  }
} 

// display list of their deleted pages and give them a 'restore' checkbox
foreach($deletedPages as $p) {
  echo "<li><label><input type='checkbox' name='restore[]' value='{$p->id}' /> {$p->title}</label></li>";
}



#5 evanmcd

evanmcd

    Full Member

  • Members
  • PipPipPip
  • 82 posts
  • 28

Posted 03 July 2012 - 04:45 PM

Thanks Ryan, I think I will go for option 1. I hadn't thought of that, and it seems like a fine solution for this.

We are also using the published status, so it can't do double duty in this case. This is an odd situation in which we have an agency administering the contest that uses subcontractors to actually review the submissions. We want the agency to be able to see and remove from trash (to keep tabs on their contractors), but of course we don't want the agency doing much else in the admin.

Anyway, thanks again. I'll post back here with any tips in case someone else with a similar need stumbles across this post later on.

Cheers.





Also tagged with one or more of these keywords: permissions, users

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users