Creating a community site I have the need to allow for content creation, but at the same time prevent destruction of that content from abuse or user error. An important aspect of that is the ability to delete. There are instances where I would like users to add content but it would be a bit disastrous to allow them to delete other peoples content from that same node. A delete permission would allow me to give users more freedom to add, and allow me to designate content moderators to handle abuse at the same time.

Has adding that level of granularity to filefield permissions been considered?

Thanks for reading.

Comments

quicksketch’s picture

There's no field-level ability to restrict editing fields within the same node. FileField does not support associating individual fields with user IDs (nor does any other module). Each node belongs to one user, and that's about as granular as Drupal is intended to support. There is support for field-level view permissions if you enable the Content Permissions module that comes with CCK, but if you're allowing multiple users to edit the same node, I think you need to revisit the site architecture and plan it so that users can only edit their own nodes.

highvoltage’s picture

Well, it's a community site that's intended to run on community contributions. I can't restrict users to only editing their own nodes without defeating the purpose of the site sadly. There's got to be a solution somewhere. Maybe I'll take it to the forums.

Thanks for your quick response.

quicksketch’s picture

Status: Active » Closed (won't fix)

I've never seen any module that provides field-level permissions within the same node. It's still plenty possible to build a community site with each user creating separate nodes, my guess is that you've built node-based image galleries or similar? It'd be best to have each user create separate nodes, then tie them together with Views.

Regardless of how the site is built, this won't be added to FileField. If anywhere, it needs to be supported by CCK directly, not within just a single field type.

tyler.frankenstein’s picture

I just wanted to throw this out there as an example module based solution to this problem.

function my_module_form_alter(&$form, &$form_state, $form_id) {
  global $user;
  switch ($form['type']['#value']) {
    case "my_content_type":
      if (user_access("administer nodes")) { break; }
      foreach (array_keys($form['field_my_images']) as $key) {
        if (!is_numeric($key)) { continue; }
        if ($form['field_my_images'][$key]['#default_value']['fid']) {
          if ($form['field_my_images'][$key]['#default_value']['uid'] != $user->uid) {
            $form['field_my_images'][$key]['#access'] = false;
          }
        }
      }
      break;
  }
}

Thanks to a few folks in #drupal-support for the help!