When rebuilding permissions I now get this error after installing the module setting some access restirctions on specfici content types.

An error has occurred.
Please continue to the error page

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /batch?id=149&op=do_nojs&op=do
StatusText: Internal Server Error
ResponseText: {}

Comments

F.E.M created an issue. See original summary.

acrosman’s picture

Using the dev version from August 24th, 2016 I'm seeing the same issue. The underlying PHP error is:

2016/08/31 13:48:36 [error] 946#946: *125 FastCGI sent in stderr: "PHP message: Uncaught PHP Exception Drupal\Core\Database\DatabaseExceptionWrapper: "SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'gid' at row 1: INSERT INTO {node_access} (nid, langcode, fallback, realm, gid, grant_view, grant_update, grant_delete) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7), (:db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15); Array
(
    [:db_insert_placeholder_0] => 1
    [:db_insert_placeholder_1] => en
    [:db_insert_placeholder_2] => 1
    [:db_insert_placeholder_3] => content_access_roles
    [:db_insert_placeholder_4] =>
    [:db_insert_placeholder_5] => 1
    [:db_insert_placeholder_6] => 1
    [:db_insert_placeholder_" while reading response header from upstream, client: 192.168.2.1, server: ~^(?<domain>.+)\.fpm.sandbox$, request: "POST /batch?id=68&op=do_nojs&op=do&_format=json HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "www.example.org.fpm.sandbox", referrer: "http://www.example.org.fpm.sandbox/batch?id=68&op=start"

I have Content Access enabled, and have setup a single content type to have node specific permissions. Any time I try to save the content type or rebuild permissions the same error is triggered.

acrosman’s picture

Looks like the permission rebuild after install is critical to module function. If you do not rebuild the site's permissions before doing anything else the module will fail to detail group IDs correctly and return a blank from content_access_get_role_gid(). Once that happens the solution appears to be to uninstall the module, reinstall, rebuild permissions, and then re-setup permissions.

acrosman’s picture

Status: Needs work » Needs review
StatusFileSize
new1.31 KB

Removing the config/install yml file prevents the unrecoverable state. Also to avoid conflicts with the main configuration management system the hook_install() needs to check to make sure a configuration sync isn't running. Patch to do both attached.

Status: Needs review » Needs work

The last submitted patch, 4: config-install-2719605-4.patch, failed testing.

richienabuk’s picture

Please what's the status on this because i intend to use it on a production site.
Thanks

farnoosh’s picture

Could not apply the patch!

gisle’s picture

Assigned: alexborsody » Unassigned

Unassigning to let others work on this.

Patch needs a reroll to apply to HEAD.

gagelafleur’s picture

Status: Needs work » Needs review
StatusFileSize
new1.09 KB

Attempting re-roll of #4

martins.bertins’s picture

I had an exact SQL error and the problem was that content_access settings did not have mappings for all user roles under content_access_roles_gids.

I fixed it by running this drush command
drush ev "require_once drupal_get_path('module', 'content_access').'/content_access.install'; content_access_install();"

gisle’s picture

Version: 8.x-1.x-dev » 2.0.x-dev

All bug fixes go into the most recent branch.

gisle’s picture

Status: Needs review » Needs work

Automated tests fail. Needs reroll for 2.0.x-dev.

steven jones’s picture

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.