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

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bluegeek9 created an issue. See original summary.

bluegeek9’s picture

Issue summary: View changes
bluegeek9’s picture

I 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.

bluegeek9’s picture

Title: authorization_group_groups field » Revoke membership and roles not assigned by authorization

I 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.

bluegeek9’s picture

Title: Revoke membership and roles not assigned by authorization » Revoke membership and roles previously assigned by authorization
Version: 2.0.x-dev » 8.x-1.x-dev
Issue summary: View changes