Node Permission Changes Not Being Applied

Snog

Well-known member
I have an application where the node permissions need to be changed from the public side of the site. I have a set of pre-defined permissions that are applied to a node using this..

Code:
$perm_model->updateContentPermissionsForUserCollection($permissions, 'node', $dwInput['node_id'], 2, 0);

That part works perfectly, I go into the node permissions and they are changed.

However, the permissions aren't being applied. So, the user groups still have their old permissions.

Looking at the updateContentPermissionsForUserCollection function, the permission cache is suppose to be rebuilt, which I would imagine also applies the changes. But that isn't happening unless I manually save the permissions again in the Admin area.

Am I missing something obvious again?
 
Just to add to this, oddly enough in the rebuildPermissionCacheForUserGroup function, the value returned in $combinations is a smaller array set on the public side than it is on the admin side.

I think that's the problem since the user I'm testing with isn't in the $combinations array on the public side, but is in the array on the admin side.

Any ideas why that might be?
 
I've narrowed it down a little more...

When I update node permissions, I'm doing it for multiple usergroups. IE: the administrator group and the registered group.

If I only update one of the groups, the change takes place with no problems. But if I call updateContentPermissionsForUserCollection more than once, the second call fails to fully apply the changes.

The second call does not fully apply permissions in this code...
Code:
// ADMINISTRATOR USERGROUP
$permissions = $this->_nodeAdminPermissions;
$perm_model->updateContentPermissionsForUserCollection($permissions, 'node', $dwInput['node_id'], 3, 0);
// REGISTERED USERGROUP
$permissions = $this->_nodeRevokePermissions;
$perm_model->updateContentPermissionsForUserCollection($permissions, 'node', $dwInput['node_id'], 2, 0);

If I comment out the administrator code, the registered code applies right away.
 
Last edited:
I've gotten around this problem by setting one of the permission sets in the return page for the script.

But I'm still curious as to why the permissions for two groups can't be set in the same place. I'm thinking it has something to do with a DB commit.
 
Top Bottom