Active
Project:
Nodequeue
Version:
6.x-2.1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 Jun 2009 at 17:54 UTC
Updated:
8 Jun 2009 at 17:54 UTC
You may consider this a duplicate of http://drupal.org/node/272298, however, it seems to me that a simple approach to allowing more flexible and granular controls for queue permissions would be to change the following:
if ($queue->owner != 'nodequeue') { // Avoids an infinite loop.
$function = $queue->owner . '_queue_access';
if (function_exists($function)) {
$access = $function($queue, $account);
}
}
to:
if ($queue->owner != 'nodequeue') { // Avoids an infinite loop.
$function = $queue->owner . '_queue_access';
$access = module_invoke_all($function, $queue, $account);
foreach ($access as $a) {
if (!$a || $a == FALSE) {
$access = FALSE;
continue;
}
else {
$access = TRUE;
}
}
}
I'm keeping $queue->owner in the function name to allow for more granularity but it's probably not really necessary.
This change would need to be made to both nodequeue_api_queue_access and nodequeue_api_subqueue_access but would provide a more "typical" way to override permissions control. I'm doing this in a separate module now (using menu_alter to insert my access hooks) and it seems to work well. Do you see any major problems with this approach?