Skip to content

System Hook group_member_data doesn't include full paths for subgroups.

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

System Hook updates for group_member_data uses model.group.path. For subgroups, this will only return the name of the subgroup, and not the entire path. This makes it difficult to identify which subgroup and/or consume the hook data.

Example from System Hooks

{
    "created_at": "2012-07-21T07:30:56Z",
    "updated_at": "2012-07-21T07:38:22Z",
    "event_name": "user_add_to_group",
  "group_access": "Maintainer",
      "group_id": 78,
    "group_name": "StoreCloud",
    "group_path": "storecloud",
    "user_email": "johnsmith@gmail.com",
     "user_name": "John Smith",
 "user_username": "johnsmith",
       "user_id": 41
}

storecloud could be a subgroup actually existing in production/storecloud or staging/storecloud

Problem to solve

Include full path in payload output (already done in group_data).

https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/system_hooks_service.rb#L131

  def group_member_data(model)
    {
      group_name: model.group.name,
      group_path: model.group.path,
      group_full_path: model.group.full_path, # <= Additional Field
      group_id: model.group.id,
      user_username: model.user.username,
      user_name: model.user.name,
      user_email: model.user.email,
      user_id: model.user.id,
      group_access: model.human_access
    }
  end

User experience goal

Make the system hooks easier to consume and include full path identifying information.

Proposal

Add group_full_path to payload output:

group_full_path: model.group.full_path, # <= Additional Field

Workaround

Currently, the group_id can be used to lookup / correctly identify the specific group/subgroup.

Links / references

Internal ZD

Edited by 🤖 GitLab Bot 🤖