Skip to content

Commit f90ae7e

Browse files
feat: add saml group links
1 parent e6f1bd6 commit f90ae7e

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

gitlab/v4/objects/groups.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
from gitlab import exceptions as exc
88
from gitlab import types
99
from gitlab.base import RESTManager, RESTObject
10-
from gitlab.mixins import CRUDMixin, ListMixin, ObjectDeleteMixin, SaveMixin
10+
from gitlab.mixins import (
11+
CRUDMixin,
12+
ListMixin,
13+
NoUpdateMixin,
14+
ObjectDeleteMixin,
15+
SaveMixin,
16+
)
1117
from gitlab.types import RequiredOptional
1218

1319
from .access_requests import GroupAccessRequestManager # noqa: F401
@@ -49,6 +55,8 @@
4955
"GroupDescendantGroupManager",
5056
"GroupSubgroup",
5157
"GroupSubgroupManager",
58+
"GroupSAMLGroupLink",
59+
"GroupSAMLGroupLinkManager",
5260
]
5361

5462

@@ -88,6 +96,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
8896
subgroups: "GroupSubgroupManager"
8997
variables: GroupVariableManager
9098
wikis: GroupWikiManager
99+
saml_group_links: "GroupSAMLGroupLinkManager"
91100

92101
@cli.register_custom_action("Group", ("project_id",))
93102
@exc.on_http_error(exc.GitlabTransferProjectError)
@@ -399,3 +408,15 @@ class GroupDescendantGroupManager(GroupSubgroupManager):
399408

400409
_path = "/groups/{group_id}/descendant_groups"
401410
_obj_cls: Type[GroupDescendantGroup] = GroupDescendantGroup
411+
412+
413+
class GroupSAMLGroupLink(ObjectDeleteMixin, RESTObject):
414+
_id_attr = "name"
415+
_repr_attr = "name"
416+
417+
418+
class GroupSAMLGroupLinkManager(NoUpdateMixin, RESTManager):
419+
_path = "/groups/{group_id}/saml_group_links"
420+
_obj_cls: Type[GroupSAMLGroupLink] = GroupSAMLGroupLink
421+
_from_parent_attrs = {"group_id": "id"}
422+
_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
@@ -282,3 +282,11 @@ def test_group_transfer(gl, group):
282282

283283
transferred_group = gl.groups.get(transfer_group.id)
284284
assert transferred_group.path == transferred_group.full_path
285+
286+
287+
@pytest.mark.gitlab_premium
288+
def test_group_saml_group_links(gl):
289+
group = gl.groups.create({"name": "gitlab-test-group", "path": "gitlab-test-group"})
290+
group.saml_group_links.create(
291+
{"saml_group_name": "saml-group-1", "access_level": 10}
292+
)

0 commit comments

Comments
 (0)