Hi!

Thanks for releasing these features. I'm currently trying to add them to a site running Drupal 7.16 running Rules 7.x-2.2 and Features 7.x-1.0.

It seems that module installation fails when Drupal tries to enable new permissions for the Administrator role. The SQL queries fail when Drupal doesn't provide the module name that's required by the role_permission table. Role 3 is the default Administrator role and access rules link job_unpublish is a Role that apparently was exported using Features from the Rules module.

I'm not sure if the issue occurs on Export or whether you can tweak something so that the Import script gets the proper information.

Notice: Undefined index: access rules link job_unpublish in user_role_grant_permissions() (line 3041 of /webserver/quick-drupal-20121023071359/drupal/modules/user/user.module).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 19 role_permission.module may not be NULL: INSERT INTO {role_permission} (rid, permission, module) VALUES (?, ?, ?); Array ( [0] => 3 [1] => access rules link job_unpublish [2] => ) in user_role_grant_permissions() (line 3043 of /webserver/quick-drupal-20121023071359/drupal/modules/user/user.module).

Comments

svenryen’s picture

This note might be useful:

http://drupal.org/node/1063204#comment-6478704

[...] I overcame this issue by setting all permissions in the last feature enabled in the stack. I found it helpful to have a final feature at the end to overcome pesky settings or run custom code.

Perhaps you can export the Rules and Permissions to a separate module to see if it helps?

mh86’s picture

Thanks for posting this issue and the link to the issue in the Feature's issue queue.

We've experienced similar problems on a few sites already, and the current permissions system is really ugly (it should be more robust for such cases).
Exporting them in two different modules would theoretically work, but I really don't want to do that. I makes the features development workflow more complicated and the feature module is more or less incomplete without the permissions.

We'll try the patch from #1063204: Adding a new permission causes integrity constraint violation. If it helps, we can include the patch in the make file of the distribution.

svenryen’s picture

@mh86 - thanks for such a quick response! yes, i can certainly see why that would be a mess.. You'd need a separate Rules and Permissions module for each one of your sub modules.

I tried patch #32 from that issue node already (for import) and it didn't help. It seems that on export, Rules didn't provide everything needed to import, so the pain point probably lies with export of Rules. The bug is triggered by Drupal's helpful addition of all available permissions to the Admin user (a workaround would be to comment out that part while enabling the Recruiter features).

mh86’s picture

Title: Installation of module fails when importing features from Rules » Installation of module fails when importing permissions from Rules Link

Small correction: the problem is actually related to Rules Links, which exposes separate permissions for each link configuration.

mh86’s picture

and one more question: are you using the Recruiter distribution or do you have your own installation and added the Recruiter features module?

svenryen’s picture

I can't remember. Sorry, I didn't notice your follow up. Believe it was the module and not the distribution

dasjo’s picture

Status: Active » Needs review

please have a look at #1905464-2: Upgrade failure - Integrity constraint violation: 1048 Column 'module' cannot be null and lets mark this as a duplicate if it fixes the problems stated above

svenryen’s picture

Status: Needs review » Closed (duplicate)

Yes, I haven't tested though it seems to be the same issue. Thanks!