Cannot reproduce Changing a permission's permission_group_id does not update xf_permission_entry table

DragonByte Tech

Well-known member
Affected version
2.0.2
Steps to reproduce:
1. Create a permission, f.ex. group ID dbtechEcommerce and permission ID viewLicenses
2. Set permissions for a user group and/or a user to something other than No (unset)
3. Change the permission's group ID to f.ex. dbtechEcommerceAdmin
4. Unprofit:
kQmAy5o.png


This may not be a serious issue for user groups, but it means there will be a permanent "Users with permissions set" display on the user permissions page.


Fillip
 
There is code to handle this and as a result, I can't reproduce what you're reporting:
PHP:
if ($this->isChanged(['permission_group_id', 'permission_id']))
{
   $update = [
      'permission_group_id' => $this->permission_group_id,
      'permission_id' => $this->permission_id
   ];
   $this->db()->update('xf_permission_entry',
      $update,
      'permission_group_id = ? AND permission_id = ?',
      [$this->getExistingValue('permission_group_id'), $this->getExistingValue('permission_id')]
   );
   $this->db()->update('xf_permission_entry_content',
      $update,
      'permission_group_id = ? AND permission_id = ?',
      [$this->getExistingValue('permission_group_id'), $this->getExistingValue('permission_id')]
   );

   $this->enqueueRebuild();
}
 
Have you been able to reproduce this since @DragonByte Tech? I just had another go and all seems to be ok.
Seems to be fine, it's possible this was an issue in 2.0.0 or 2.0.1 as I have no idea when exactly this would have happened somewhere between the end of November and today.

If I ever notice anything like this again I'll post a new thread but for now this report can be thrown away :)


Fillip
 
Interesting, that code has been in place for about 4 years so... hmm...

Are you sure the permission renames weren't done directly in the database, perhaps during a Setup/Upgrade query? I know I've been caught out by similar things before.

But, yeah, we'll close this for now.
 
Are you sure the permission renames weren't done directly in the database, perhaps during a Setup/Upgrade query? I know I've been caught out by similar things before.
That's perfectly possible, I do know that changing the group ID was done when I was experimenting with content permissions *cough* implement this suggestion the code has been tested thoroughly by now */cough* since I didn't want those permissions to be set per-content.

I may have done DB updates instead of going through the proper UI, or the permission entries may have been set by my implementation of the content permissions after the UI changed when I was still developing the content permissions system 🤔


Fillip
 
Back
Top Bottom