Skip to content

Add group.members.remove options skip_subresources and unassign_issuables #3230

@matthias-reiff

Description

@matthias-reiff

Description of the problem, including code/CLI snippet

Current implementation to remove members from GitLab group is:
group.members.delete(member_id)
Additionally to the member_id parameter, the rest API endpoint provides two options which are currently not available in the python-gitlab group members delete method (Reference):

  • skip_subresources
  • unassign_issuables

This is especially relevant, as skip_subresources has the default value false. The pendant in the Web UI is the Also remove direct user membership from subgroups and projects option which needs to be ticked actively, suggerating a default value skip_subresources = true:

Image

As the option for skip_subresources is not available in the python-gitlab library, the default value of false is enforced. This may lead to unexpected behavior, when only the group level access right should be removed without removing access rights to subresources.

Example

  • Create group foo
  • Create project foo/bar
  • Grant user xyz Maintainer access to project foo/bar
  • Grant user xyz Developer access to group foo
  • Delete xyz as member from group foo using default behavior:
    A) WebUI: user xyz stays Maintainer member in project foo/bar
    B) python-gitlab: user xyz looses also Maintainer access in project foo/bar

Expected Behavior

There should be the same parameters available in group.members.delete(member_id) as in the Rest API:

group.members.delete(
    member_id=membe_id,
    skip_subresources=False,
    unassign_issuables=False
)

Actual Behavior

Currently those flags can not be specified, enforcing the default behavior defined in the Rest API.

Specifications

  • python-gitlab version: 6.1.0
  • Gitlab server version (or gitlab.com): v17.11.6-ee

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions