Download & Extend

Export permissions configuration when used with Features module

Project:Custom Permissions
Version:7.x-2.0
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hi, I was just in the process of migrating a site from development into testing and you Features integration has made this an easier process, so thanks for that!
However, it would seem (unless i'm missing something) that this integration only goes as far as defining the custom permission - it doesn't also include and specific user settings (roles) for that permission.

To try and be more clear, there are three roles set up: anonymous, authenticated and editors.
A new permission is created: "View Pictures of Cats" and only authenticated and editor roles have this permission.

If you then try to export/move this permission via the Features module, yes it shows up in the list of permissions during Feature creation, and yes the permission is correctly installed in the new Website, but no one is assigned the permission.

All standard drupal permissions and their corresponding settings work, as do all of the contrib modules' permissions that I've tested so far. It's only those created by this module that don't take their settings with them.

Are there any plans to add this level of integration between Custom Permissions and Features? I for one believe it would be a very useful addition!

Cheers.

Comments

#1

did you select both the permission and custom permissions dependency under features? (seperate selections)

#2

Yeah, I selected the permissions themselves, and Features auto-detected that Custom Permissions (config_perms) was a dependency along with ctools.

From looking at the module produced, I get the permissions defined as follows...

/**
* @file
* permissions_view_contact_enquiries.config_perms.inc
*/

/**
* Implementation of hook_config_perms().
*/
function permissions_view_contact_enquiries_config_perms() {
  $export = array();

  $config_perms = new stdClass;
  $config_perms->disabled = FALSE; /* Edit this to true to make a default config_perms disabled initially */
  $config_perms->api_version = 1;
  $config_perms->machine_name = 'view_contact_enquiries_of_type_charity_cup_enquiry';
  $config_perms->status = TRUE;
  $config_perms->name = 'view contact enquiries of type: charity cup enquiry';
  $config_perms->path = array(
    0 => 'company/contact-us/entries/charity-cup',
  );
  $export['view_contact_enquiries_of_type_charity_cup_enquiry'] = $config_perms;

  // Repeat for all custom permissions
 
  return $export;
}

The .info file correctly specifies the permissions themselves along with the dependencies.

When I export 'standard' permissions (ie, those not created with the Custom Permissions module), then the following function is included instead:

/**
* Implementation of hook_user_default_permissions().
*/
function configuration_permissions_user_default_permissions() {
  $permissions = array();

  // Exported permission: access comments
  $permissions['access comments'] = array(
    'name' => 'access comments',
    'roles' => array(
      0 => 'administrator',
      1 => 'anonymous user',
      2 => 'authenticated user',
      3 => 'pre-authorised',
    ),
    'module' => 'comment',
  );

  // Exported permission: access rules debug
  $permissions['access rules debug'] = array(
    'name' => 'access rules debug',
    'roles' => array(),
  );

  // Repeat for all other permissions

  return $permissions;
}

So am I missing something? Is this supposed to work? Cheers for your time.

nobody click here