After installing permissions_by_term module, I get the following error: Uncaught PHP Exception Drupal\\Core\\Database\\InvalidQueryException: "Query condition 'ti.tid IN ()' cannot be empty." Installed the latest dev version of the module through git.

Comments

prathibhab.cdac created an issue. See original summary.

nielsvoo’s picture

subscribe!

jepster_’s picture

Could you please provide a bit more details? I have installed a fresh Drupal and afterwards the Permissions by Term stable version (which is the stame what the dev version is) and I can install it without issues. Does this error appear on a specific page?

prathibhab.cdac’s picture

I installed drupal. Then installed the branch 8.x-1.24 version of permissions_by_term module.

Enabled the permission by term module. Drupal works fine. There are no issues.

Now I uninstalled permissions by term module.

Applied the patch http://cgit.drupalcode.org/permissions_by_term/commit/?id=fd239d9c58ecb4....

Now in the drupal website, I enabled permissions by term module. Under the taxonomy term asssigned the permission for an user. I tried to login as that user. The site shows "website encountered an error."

The apache error shows:

Uncaught PHP Exception Drupal\\Core\\Database\\InvalidQueryException: "Query condition 'ti.tid IN ()' cannot be empty." at /var/www/html/drupal/core/lib/Drupal/Core/Database/Query/Condition.php line 103, referer: http://localhost/drupal/system/403

nielsvoo’s picture

On my site it appears when anonymous visitors try to open a page containing a view based on items with Term rights.
In other words:

- administrator role works fine
- users with roles can see the page but items on it (the ones labeled with Term rights) wont be displayed.

Hope this helps.

prathibhab.cdac’s picture

The login page is not getting loaded. Instead it only shows "Website encountered an error"

jepster_’s picture

The recent version is 8.x-1.25. Please check this one. I got no problem with it and run all my behat tests on it.

You have mentioned 8.x-1.24. That's an old version.

jepster_’s picture

prathibhab.cdac’s picture

I'm getting the error with the latest version 8.x-1.25. Thats why I checked with the previous version.

nielsvoo’s picture

i have this error after installing 1.25 (no dev version), the previous version 1.22 works fine

  • df1e75a committed on 8.x-1.x
    Issue #2904080 by prathibhab.cdac and nielsvoo: Uncaught PHP Exception
    
jepster_’s picture

Status: Active » Needs review

There has been a simple if-case missing. I have pushed the change into the latest development version: https://www.drupal.org/project/permissions_by_term/releases/8.x-1.x-dev. Please check it. If you have no objection, I will put this into the release soon.

Thanks for reporting.

prathibhab.cdac’s picture

I've tested with the latest version from git. Its working fine now.

jepster_’s picture

Status: Needs review » Fixed

Thanks. I have created release 8.x-1.26 with the fix in it.

Please check the issue Automated Tests, if you like to contribute.

nielsvoo’s picture

thanks for all the help!

nielsvoo’s picture

Sorry there is still something wrong.

I've rebuild the permissions and some items are displayed. But only the items labeled to a roll. The normal behavior in Drupal were items not labeled at all will be available to all users (no matter there roll) isn't working now.

jepster_’s picture

@nielsvoo: I do not understand, what you mean. Especially the world "roll" confuses me. This is not a Drupal term.

If you rebuild the permissions, restricted nodes will not be shown to users which do not have access to them. These nodes will be not listed in views, menus and search results. Could you please describe your issue more detailed? Any screenshots may help.

jepster_’s picture

May the documentation can help you: https://www.drupal.org/docs/8/modules/permissions-by-term. Just as hint.

nielsvoo’s picture

Ok i give it a try:

in version 1.22 the behavior is:

Taxonomy
term "dummy" = connected to user role "internal"

Node
node "1" = Connected to Permission Term (dummy)
node "2" = Not connected to any permission

All users connected to user role (internal) will see node "1" and node "2"
All other users get only node "2"

Now in the new version 1.2.6 the behavior is:

Taxonomy
term "dummy" = connected to user role "internal"

Node
node "1" = Connected to Permission Term (dummy)
node "2" = Not connected to any permission

All users connected to user role (internal) will see just node "1"
All other users get's empty pages

Thanks,
Niels

jepster_’s picture

Status: Fixed » Needs work

OK, this description is clear. I will check this asap.

nielsvoo’s picture

Ok thank you..

jepster_’s picture

You are welcome. Thanks for reporting.

  • df1e75a committed on 2904080-uncaught-php-exception
    Issue #2904080 by prathibhab.cdac and nielsvoo: Uncaught PHP Exception
    
darin73’s picture

Same problem as #19, also with version 1.26

jepster_’s picture

Yep, I am on it. The fix will come soon. May this evening (central european time).

  • Peter Majmesku committed 5410256 on 8.x-1.x
    Issue #2904080 by nielsvoo and darin73: Access restriction regression...
jepster_’s picture

Status: Needs work » Fixed

I have fixed the error described in #19 from nielsvoo in version 8.x-1.27. See release note: https://www.drupal.org/project/permissions_by_term/releases/8.x-1.27.

Please test the current version and open an issue, if you find any problem.

Thanks again for reporting.

You can find the updated Behat features for automated tests at https://github.com/jepster/permissions-by-term-behat.

darin73’s picture

The release 8.x-1.27 fix the problem.
thanks

jepster_’s picture

I'm glad to read this. Thanks for testing.

nielsvoo’s picture

Thanks Peter,

Installed version is correct now!

Nielsvoo

jepster_’s picture

I am glad to read this. Thanks for testing nielsvoo! :)

nielsvoo’s picture

You're welcome.

I've upgraded to 1.28 and this one is working fine also, although there is still one challenge. Since the upgrade i have to rebuild permissions all the time otherwise new users still get empty pages?

I didn't check this behavior in 1.27 so it maybe there also. Until now 1.22 is still the version in my production environment because of this. Every day thousands of users visits the pages on this site and new ones are created every day. This is all completely automated by Single Sign On techniques and user role provisioning. Therefore users have to see their items immediately after login, even for the first time.

Have you got any explanation why rebuilding the user rights is needed for this?

  • 8afa620 committed on 8.x-1.x
    Issue #2904080 by nielsvoo: Removing node access rebuild on user insert/...
jepster_’s picture

Yes, you are right. Since the node access records aren't tied to users anymore, I have removed this in the dev version. Good that this project has pro-active users, with large sites. :)

jepster_’s picture

nielsvoo’s picture

He Peter,

Unfortunately no success. With the new update even the admin gets empty pages. What was wrong with version 1.22 as this one seems to work flawless?

Nielsvoo

jepster_’s picture

Status: Fixed » Postponed (maintainer needs more info)

Hi Nielsvoo,

I am sorry to read your objection. Please help me to reproduce your issue. I cannot reproduce it so far.

Since the upgrade i have to rebuild permissions all the time otherwise new users still get empty pages?

When do you have to rebuild the permissions? Please be so kind and provide a "step-by-step" introduction, which allows me to reproduce your issue. It is not necessary anymore, to recreate permissions, after any user account has been created or any user account has been updated. Because the node access records (database table: node_access) are created after an new node has been created. The node access records are created in relation to nodes "only". Not to user accounts "and" nodes via node_access table.

In 1.22 has been a large performance draw back. Node access records have been created in relation to nodes "and" users. Therefor an huge amount of node access records has been created on large Drupal sites. The node access rebuild process took very long. Now the processing time has been reduced massively.

I am looking forward to your description.

Thanks!
Peter

jepster_’s picture

Status: Postponed (maintainer needs more info) » Fixed

@nielsvoo: Please be so kind and let's community further in this issue: https://www.drupal.org/node/2905328. I have quoted you there. Since the initial problem from this issue, has been fixed.

I am closing this issue.

nielsvoo’s picture

Hi Peter,

Good news, i saw there was an error with entity dependencies after upgrading, i completely uninstalled the module en reinstalled the new 1.29 version, now the error is gone and it seems to work all fine.

Thanks for all the great help, you are definitely a serious maintainer, keep up the great work.

Nielsvoo

jepster_’s picture

Thanks. :)

Status: Fixed » Closed (fixed)

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