Download & Extend

Using Drafts with MERCI to generate Templates

Project:Draft
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

When using Drafts in Template mode, it would be helpful to add a role based permission instead of limiting use of Drafts to the user who created the draft. I've created a screencast to show how we're using Drafts with MERCI...

http://openmediaproject.blip.tv/file/4516676/

The merci_template submodule had some basic templating functionality in a eraly version, but it only stored the default fields. As users customized the merci_reservation content type, merci_template was less useful. Drafts works well when these changes are made, but is too restrictive with permission to create a new node from a draft.

To make this work, we've made two changes...

function draft_perm() {
  return array('access save as draft', 'access drafts saved as templates');
}

Then in draft_form_alter we need add the option of access drafts created to be used as templates...


if (is_null($result->uid)) {
// Set not found if the draft does not exist
drupal_not_found();
die();
} elseif ($result->uid != $user->uid && user_access('access save as draft') || !user_access('access drafts saved as templates') ) {
// Deny the user access if the draft is not theirs
drupal_access_denied();
die();
}

Longer term I'd like to add columns to the drafts table for template and an array of roles that can access that template, but it would only make sense to create a patch for that if you are open to allowing users other than drafts creator access to use the draft. The way I've configured it now, I'm taking advantage of the fact the MERCI is normally configured to use Auto Node Title. I'm flagging Drafts as Templates by adding a Title. The array of roles would allow stations using Drafts with MERCI to create templates and then control which roles could access start a Reservation from that template.

nobody click here