apigee / apigee-edge-drupal

The Apigee Edge module enables you to integrate a Drupal 9 or 8 site with Apigee.
https://www.drupal.org/project/apigee_edge
GNU General Public License v2.0
32 stars 45 forks source link

__apigee_reserved__developer_details one way? #1096

Open acobat opened 2 weeks ago

acobat commented 2 weeks ago

Description

when using __apigee_reserved__developer_details attribute in appgroup to sync developers, it works one way - e.g. when you add this attr:

  {
  "attributes": [
    {
      "name": "__apigee_reserved__developer_details",
      "value": "[{\"developer\":\"testik@domain.com\",\"roles\":[\"kuku\"]}]"
    }
  ]
}

it will add kuku role to the user

however, when you will replace the role with something else:

   {
  "attributes": [
    {
      "name": "__apigee_reserved__developer_details",
      "value": "[{\"developer\":\"testik@domain.com\",\"roles\":[\"admin\"]}]"
    }
  ]
}

and sync the teams, user will get two roles: kuku, admin, e.g. old role is not removed. So, if user for example once got admin role, it cant be removed with AppGroups API, only via UI, since DB is not changed for removal, only when 'new' roles added to same user, can this be confirmed?

Apigee Info

Apigee X

Steps to Reproduce

Steps to reproduce the behavior:

  1. add new group with attribute with user and existing role, e.g. member
  2. sync
  3. add admin roles
  4. sync
  5. remove admin role
  6. sync

user will stay with admin and all roles that was added before

I just want to have confirmation that this attribute process in 'one-way' - only NEW deltas added, old roles never get removed with API (only with UI in the drupal portal)

Version Info

Drupal 10

divya-intelli commented 2 weeks ago

Hi @acobat , thanks for bringing this to our attention, we will look into it and revert soon.

kedarkhaire commented 1 week ago

Hi @acobat

Are you trying to achieve this using custom code or by UI ?

Also are you testing this with Apigee Teams Invite members functionality or with Drupal user system ?

Please let us know the versions you are using.

Thanks!

acobat commented 6 days ago

Hi, No custom code, via UI

I first created the appgroups, assigned dev to it with the custom attribute, and then synced teams from Drupal UI from teams menu. No Invites, migrating users.

Versions: Apigee X, and latest Teams from git

Try to create appgroup with Google API (the only way AFAIK). Add member to it with ROLE XXX inside the __apigee_reserved__developer_details attr, e.g.:

{ "attributes": [ { "name": "__apigee_reserved__developer_details", "value": "[{\"developer\":\"testik@domain.com\",\"roles\":[\"kuku\"]}]" } ] }

try to modify the appgroup, but replace the roles (kuku to kuku2) for example, and you will see two roles, while we expect to see the latest one, e.g. kuku2