• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

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

Affected version
2.0.2

DragonByte Tech

Well-known member
#1
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:


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
 

Chris D

XenForo developer
Staff member
#2
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();
}
 

DragonByte Tech

Well-known member
#4
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
 

Chris D

XenForo developer
Staff member
#5
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.
 

DragonByte Tech

Well-known member
#6
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
 
Top