When manually revoking the privilege given to a user, after said user has been granted 'view access' through a product purchase (with an expiration), the corresponding expiration data is not removed from the uc_node_access_expirations table. See attached screenshot.

Subsequently, if I try to revoke the privilege of another user I have to check all removed users' checkboxes, otherwise they will be given back their privilege.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webservant316’s picture

subscribe

sshhll’s picture

subscribe

jeremy.zerr’s picture

Version: 6.x-1.x-dev » 6.x-1.0
Assigned: Unassigned » jeremy.zerr

I can reproduce this on Drupal 6.22, UC 2.7, UC Node access 1.0, ACL 1.4, Content Access 1.2

I started by having 2 different users with expirations for a particular node.

If I manually remove by selecting checkbox and clicking Remove Checked, row is removed. But then I visit the page again, nothing actually happened, expiration is back exactly as it was before, shows username too (not missing like in your screenshot).

I thought then that I must have needed to hit submit after removing, so I again went in and selected checkbox, clicked Remove Checked, then hit submit, got this SQL error:

user warning: Duplicate entry '1' for key 'PRIMARY' query: INSERT INTO content_access (nid, settings) VALUES(1, 'a:6:{s:4:\"view\";a:0:{}s:8:\"view_own\";a:0:{}s:6:\"update\";a:0:{}s:10:\"update_own\";a:0:{}s:6:\"delete\";a:0:{}s:10:\"delete_own\";a:0:{}}') in /home/www-data/ucnodeaccess/sites/all/modules/content_access/content_access.module on line 375.

Now I have the blank username with the expiration showing like you have in your screenshot.

If I then go back in and repeat the same process with the other user expiration, checking box, remove checked, submit, I get the same SQL error, but my first user expiration is back with the username now. Exactly as it was before. But the 2nd user that I just revoked role has the empty username with the expiration still showing.

Now, if I just go hit submit, without doing anything, the 2nd username pops back in. So I'm back to exactly the same point that I started.

Definitely a bug...

Will be looking into it.

Jeremy Zerr
http://www.zerrtech.com

jeremy.zerr’s picture

Status: Active » Needs review
FileSize
3.4 KB

The SQL error is a bug in content_access that has been fixed in dev but not released yet.
#970802: Replace db_affected_rows() with count query to check if exist

Applied the patch and it went away as expected.

Now to the uc_node_access bugs...

What was causing the " - expires blah blah" (missing the username) on the Access Control tab for the node is due to a missed check to verify that the username in the node access expirations table actually exists in the list of users that can access the node. This check technically wouldn't be necessary if the expirations table was being kept in sync, but its still better code so I added it in.

And as mentioned, when you remove a user from ACL manually, the uc_node_access_expirations table doesn't get deleted. This patch provided solves these uc_node_access bugs by hooking into the Access Control page form submit and checking the current list of users and appropriately deleting the corresponding UC node access expirations table row.

Please test this patch out and see if that fixes the problem for you too.

Jeremy Zerr
http://www.zerrtech.com

sshhll’s picture

Version: 6.x-1.0 » 6.x-1.x-dev

Hi Jeremy,
So far the patch is doing the work.
After the patch, i test out the following

manually removed the user from the node access and the user is totally deleted from the DB.

After submit, i didn't see any blank filed with expiring date.

I'll update if i find any buggs.

Thx for the work, this is really need for this module.

sshhll’s picture

Hello,
There little hiccup.
After updated the module, when the user purchase the product with node access feature on.

User will get the node access, but if i have the filed that build into the page with the node access feature not showing up for the authorized user.

i try the user permission and not coming up.
The field only come up on the content edior or sub admin access.

Prior to the module patch, the field come up fine.

When i look at the access control of the page, the user added to have access to the node.

Any advice when i should check.

Thanks,
Sam

mr.andrey’s picture

Here is a simplified (partial) patch, which only adds the ability to fully remove the users through the Node > Content Access tab interface.

This is the only improvement that I needed. Just putting it here for reference.

Cheers,
Andrey.