Closed (fixed)
Project:
Node clone
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
22 Jan 2009 at 02:44 UTC
Updated:
11 Aug 2010 at 22:40 UTC
Jump to comment: Most recent file
the checks in this function could probably be re-rodered for better efficiency. We want ot avoid the node_access() calls if at all possible.
function clone_access($node) {
global $user;
// Check basic permissions first.
$access = (user_access('clone node') || ($user->uid && ($node->uid == $user->uid) && user_access('clone own nodes')));
// Make sure the user can view the original node content.
$access = $access && node_access('view', $node);
// Check additional conditions
$access = $access && (clone_is_permitted($node->type) && filter_access($node->format) && node_access('create', $node->type));
// Let other modules alter this - for exmple to only allow some users
// to clone specific nodes or types.
foreach (module_implements('clone_access_alter') as $module) {
$function = $module .'_clone_access_alter';
$function($access, $node);
}
return $access;
}
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | reorder-checks-362370-2-D5.patch | 1.3 KB | pwolanin |
| #1 | reorder-checks-362370-1.patch | 4.58 KB | pwolanin |
Comments
Comment #1
pwolanin commentedComment #2
pwolanin commentedfor 5.x-2.x (untested)
Comment #3
pwolanin commentedreview anyone?
Comment #4
pwolanin commentedcommitted to 6.x-1.x and 5.x-2.x