Duplicate Role Expiration Records

Created on 31 March 2024, 9 months ago
Updated 19 September 2024, 3 months ago

I have a rule to assign user a role "client" automatically when a certain action occurred. So every time when the action is taken, my rule will assign "client" to the user, regardless whether the user already has "client" role or not. Here is problem for role expiration if the "client" role has been assigned more than once:

There will be duplicate role expiration records for Client. Their expiration time is the same, so these records are completely duplicate.

I noticed that:
1. user profile display is normal -- just one Client role listed;
2. in database (table user_roles), there are multiple records of "client" for this user. Basically one action of role assignment will create one new record in table user_roles. I believe that is why Role Expire display also have multiple records.

Could you aggregate the result to move the duplicates?

Also, could you just show roles with expiration time? if a role has no expiration, could you just hide it?

Regards,

🐛 Bug report
Status

Active

Version

3.0

Component

User interface

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sdsc
  • 🇩🇪Germany Anybody Porta Westfalica

    @sdsc: Which database system are you using and in which version?

    Looking at https://git.drupalcode.org/project/role_expire/-/blob/3.x/role_expire.in...
    The combination of uid and rid is already unique: 'primary key' => array('uid', 'rid'),

    So I'm wondering how and where it should appear twice. Yould you post an excerpt as dump or screenshot to ensure I got this right?
    Have you tried to reproduce this with a fresh installation of role_expire? Might it be a missing index from the past, perhaps?

    Also please check if 4.x is affected, so we can work against the latest version.

Production build 0.71.5 2024