actions_permissions.module in Views Bulk Operations (VBO) 7.3
File
actions_permissions.module
View source
<?php
function actions_permissions_permission() {
$permissions = array();
$actions = actions_list() + _actions_permissions_advanced_actions_list();
foreach ($actions as $key => $action) {
$permission = actions_permissions_get_perm($action['label'], $key);
$permissions[$permission] = array(
'title' => t('Execute %label', array(
'%label' => $action['label'],
)),
);
}
return $permissions;
}
function _actions_permissions_advanced_actions_list() {
$actions = array();
$hidden_actions = array(
'system_block_ip_action',
'system_goto_action',
'system_message_action',
);
$result = db_query("SELECT * FROM {actions} WHERE parameters > ''");
foreach ($result as $action) {
if (in_array($action->callback, $hidden_actions)) {
continue;
}
$parameters = unserialize($action->parameters);
$actions[$action->aid] = array(
'label' => $action->label,
'type' => $action->type,
);
}
return $actions;
}
function actions_permissions_get_perm($label, $key) {
return "execute {$key}";
}