Skip to content

Commit 0e173e4

Browse files
feat: add saml group links
1 parent 9d2b1ad commit 0e173e4

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

gitlab/v4/objects/groups.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
CRUDMixin,
1313
DeleteMixin,
1414
ListMixin,
15+
NoUpdateMixin,
1516
ObjectDeleteMixin,
1617
SaveMixin,
1718
)
@@ -58,6 +59,8 @@
5859
"GroupLDAPGroupLinkManager",
5960
"GroupSubgroup",
6061
"GroupSubgroupManager",
62+
"GroupSAMLGroupLink",
63+
"GroupSAMLGroupLinkManager",
6164
]
6265

6366

@@ -98,6 +101,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
98101
subgroups: "GroupSubgroupManager"
99102
variables: GroupVariableManager
100103
wikis: GroupWikiManager
104+
saml_group_links: "GroupSAMLGroupLinkManager"
101105

102106
@cli.register_custom_action("Group", ("project_id",))
103107
@exc.on_http_error(exc.GitlabTransferProjectError)
@@ -464,3 +468,15 @@ class GroupLDAPGroupLinkManager(ListMixin, CreateMixin, DeleteMixin, RESTManager
464468
_create_attrs = RequiredOptional(
465469
required=("provider", "group_access"), exclusive=("cn", "filter")
466470
)
471+
472+
473+
class GroupSAMLGroupLink(ObjectDeleteMixin, RESTObject):
474+
_id_attr = "name"
475+
_repr_attr = "name"
476+
477+
478+
class GroupSAMLGroupLinkManager(NoUpdateMixin, RESTManager):
479+
_path = "/groups/{group_id}/saml_group_links"
480+
_obj_cls: Type[GroupSAMLGroupLink] = GroupSAMLGroupLink
481+
_from_parent_attrs = {"group_id": "id"}
482+
_create_attrs = RequiredOptional(required=("saml_group_name", "access_level"))

tests/functional/api/test_groups.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,3 +304,11 @@ def test_group_transfer(gl, group):
304304

305305
transferred_group = gl.groups.get(transfer_group.id)
306306
assert transferred_group.path == transferred_group.full_path
307+
308+
309+
@pytest.mark.gitlab_premium
310+
def test_group_saml_group_links(gl):
311+
group = gl.groups.create({"name": "gitlab-test-group", "path": "gitlab-test-group"})
312+
group.saml_group_links.create(
313+
{"saml_group_name": "saml-group-1", "access_level": 10}
314+
)

0 commit comments

Comments
 (0)