Permissions Reset

This project is not covered by Drupal’s security advisory policy.

Overview

The permissions_api module provides a method for granting and revoking permissions for a given role. This module helps with the issue of staging a Drupal site across multiple environments, from development sandbox to production environment.

The ability to import CCK content types through code 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 the following functions:

permissions_grant_permissions()
permissions_revoke_permissions()
permissions_grant_all_permissions()
permissions_grant_all_permissions_by_module()
permissions_revoke_all_permissions_by_module()
permissions_get_permissions_for_role()
permissions_get_role()
permissions_create_role()
permissions_delete_role()
permissions_role_inherit()

Maintainer

Developed and maintained by Erich Beyrent
Originally sponsored by CommonPlaces e-Solutions, LLC

News

Drupal 5 No new functionality is being added to the D5 version of this module.

Drupal 6 Version 6.x-2.8 fixes a bug where permissions supplied to grant/revoke actions were not being validated against defined permissions.

Version 6.x-2.9 adds support for Drush!

Drupal 7 It looks like much of the functionality provided by this module has been added to core in D7. I haven't fully looked at the patch yet, but at this point, it looks like there will not be a D7 version of this module. See #300993: User roles and permissions API

Contrib

Permissions Reset

The Permissions Reset module adds a new fieldset to the standard Drupal permissions administration form, and adds functionality to perform bulk grants and revokes on permissions for given roles. This module was created by KarenS.

Examples

Grant specific permissions to a specific role:

$permissions = array(
  'create some_content_type content',
  'edit some_content_type content',
  'edit own some_content_type content',
);
permissions_grant_permissions('some role', $permissions);  

Grant all permissions to a specific role:

// Create a "super-admin" role by granting all permissions
permissions_grant_all_permissions('some admin role');

Grant all permissions defined by a specific module to a specific role:

// Grant all permissions defined by a module's hook_perm implementation
permissions_grant_all_permissions_by_module('some role', 'some module')

Inherit all permissions from one role to another:

permissions_role_inherit('new role', 'original role');

Project information

Releases