The permissions_api module provides a method for adding and removing permissions from a given role. This module helps with the issue of staging a Drupal site across multiple environments, from development sandbox to production environment.
A specific example includes importing a CCK content type definition via hook_update in a custom module:
// Configure the path to the cck content type definition
$modulepath = drupal_get_path ('module', 'some_module');
$cck_definition_file = $modulepath.'/content_types/front_page_flash.php';
$values['type_name'] = '<create>';
$values['macro'] = file_get_contents($cck_definition_file);
include_once( drupal_get_path('module', 'node') .'/content_types.inc');
include_once( drupal_get_path('module', 'content') .'/content_admin.inc');
// Import the cck content type
drupal_execute("content_copy_import_form", $values);
This is great until you decide that you want members of specific roles to be able to do something with this content type. Currently, the only way to grant the permissions is to navigate through the access control page in the admin interface, which is completely unusable if you have a lot of roles and a lot of modules.
This module addresses that problem by providing two functions:
permissions_grant_permissions()
permissions_revoke_permissions()