Problem/Motivation
Group membership is granted and revoked based on mappings. This conflicts with manual assignment.
Steps to reproduce
Proposed resolution
Use the user.data service to store the mappings. This will allow every profile to revoke group:roles previously granted correctly.
$user = \Drupal::currentUser();
// Define an array of role => profile.
$roles= [
'group:1' => [
'team--administrator' => 'profile_a',
],
'group:3' => [
'team--teacher' => 'profile_b',
],
'group:5' => [
'team--staff' => 'profile_b',
],
];
// Store the array as user data.
\Drupal::service('user.data')->set('authorization_group', $user->id(), 'roles', $roles);
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
bluegeek9 commentedComment #3
bluegeek9 commentedI want to give an update. I am working on #3399979: Drupal Roles Consumer - store mappings in user.data and then plan to work on this.
Comment #4
bluegeek9 commentedI am still working on the revokeGrants functionality. I want to be able to revoke grants across multiple profiles. I also want to respect the existing delete memebership.
Comment #5
bluegeek9 commented