$action) { $perms += actions_permissions_get_perm($action['label'], $callback, 'action'); } $actions = _actions_permissions_get_custom_actions(); // advanced actions foreach ($actions as $callback => $action) { $perms += actions_permissions_get_perm($action['label'], $callback, 'advanced action'); } module_load_include('inc', 'node', 'node.admin'); foreach (array('node', 'user') as $type) { // node/user operations foreach (module_invoke_all($type .'_operations') as $operation) { if (is_array($operation['label']) || empty($operation['callback'])) { continue; } $perms += actions_permissions_get_perm($operation['label'], $operation['callback'], "$type operation"); } } return $perms; } function _actions_permissions_get_custom_actions() { $actions = array(); $static_actions = actions_list(); $result = db_query("SELECT * FROM {actions} WHERE parameters > ''"); foreach ($result as $action) { $actions[$action->aid] = array( 'label' => $action->label, 'type' => $action->type, 'configurable' => FALSE, 'parameters' => unserialize($action->parameters), ); $actions[$action->aid]['behavior'] = isset($static_actions[$action->callback]['behavior']) ? $static_actions[$action->callback]['behavior'] : null; } return $actions; } function actions_permissions_get_perm($label, $callback, $type = FALSE) { $key = "execute $callback"; return empty($type) ? $key : array($key => array( 'title' => t('Execute !label', array('!label' => $label)), 'description' => t('Execute !type "!label" (!callback).', array('!type' => t($type), '!label' => $label, '!callback' => is_numeric($callback) ? "aid:$callback" : $callback)), ), ); }