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

Docc’s picture

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

carl.brown’s picture

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.

itaine’s picture

I'm getting this as well.

@carl.brown... did you or anyone resolve this or find a work around?

elvizzi’s picture

I have this same issue! Took me a while to narrow it down to Custom Permissions.

elvizzi’s picture

OK, I managed to work through it!

First I installed the latest dev which contained the patch discussed in this thread: http://drupal.org/node/1229198

This caused other issues, so I installed the patch discussed in this thread: http://drupal.org/node/1274800#comment-5850160

This fixed my install profile issue. Hope it helps somebody out.

mlncn’s picture

Issue summary: View changes
Status: Active » Fixed

The issues elvizzi referenced as needing to fix it are resolved now, so marking this fixed too.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.