Skip to content

Commit 5c8b7c1

Browse files
nejchJohnVillalovos
authored andcommitted
refactor(groups): remove deprecated LDAP group link add/delete methods
BREAKING CHANGE: The deprecated `group.add_ldap_group_link()` and `group.delete_ldap_group_link()` methods are no longer available. Use `group.ldap_group_links.create()` and `group.ldap_group_links.delete()` instead.
1 parent 27ed490 commit 5c8b7c1

File tree

1 file changed

+1
-59
lines changed

1 file changed

+1
-59
lines changed

gitlab/v4/objects/groups.py

+1-59
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import gitlab
66
from gitlab import cli
77
from gitlab import exceptions as exc
8-
from gitlab import types, utils
8+
from gitlab import types
99
from gitlab.base import RESTManager, RESTObject
1010
from gitlab.mixins import (
1111
CreateMixin,
@@ -164,64 +164,6 @@ def search(
164164
path = f"/groups/{self.encoded_id}/search"
165165
return self.manager.gitlab.http_list(path, query_data=data, **kwargs)
166166

167-
@cli.register_custom_action("Group", ("cn", "group_access", "provider"))
168-
@exc.on_http_error(exc.GitlabCreateError)
169-
def add_ldap_group_link(
170-
self, cn: str, group_access: int, provider: str, **kwargs: Any
171-
) -> None:
172-
"""Add an LDAP group link.
173-
174-
Args:
175-
cn: CN of the LDAP group
176-
group_access: Minimum access level for members of the LDAP
177-
group
178-
provider: LDAP provider for the LDAP group
179-
**kwargs: Extra options to send to the server (e.g. sudo)
180-
181-
Raises:
182-
GitlabAuthenticationError: If authentication is not correct
183-
GitlabCreateError: If the server cannot perform the request
184-
"""
185-
utils.warn(
186-
message=(
187-
"The add_ldap_group_link() method is deprecated and will be removed "
188-
"in a future version. Use ldap_group_links.create() instead."
189-
),
190-
category=DeprecationWarning,
191-
)
192-
path = f"/groups/{self.encoded_id}/ldap_group_links"
193-
data = {"cn": cn, "group_access": group_access, "provider": provider}
194-
self.manager.gitlab.http_post(path, post_data=data, **kwargs)
195-
196-
@cli.register_custom_action("Group", ("cn",), ("provider",))
197-
@exc.on_http_error(exc.GitlabDeleteError)
198-
def delete_ldap_group_link(
199-
self, cn: str, provider: Optional[str] = None, **kwargs: Any
200-
) -> None:
201-
"""Delete an LDAP group link.
202-
203-
Args:
204-
cn: CN of the LDAP group
205-
provider: LDAP provider for the LDAP group
206-
**kwargs: Extra options to send to the server (e.g. sudo)
207-
208-
Raises:
209-
GitlabAuthenticationError: If authentication is not correct
210-
GitlabDeleteError: If the server cannot perform the request
211-
"""
212-
utils.warn(
213-
message=(
214-
"The delete_ldap_group_link() method is deprecated and will be "
215-
"removed in a future version. Use ldap_group_links.delete() instead."
216-
),
217-
category=DeprecationWarning,
218-
)
219-
path = f"/groups/{self.encoded_id}/ldap_group_links"
220-
if provider is not None:
221-
path += f"/{provider}"
222-
path += f"/{cn}"
223-
self.manager.gitlab.http_delete(path, **kwargs)
224-
225167
@cli.register_custom_action("Group")
226168
@exc.on_http_error(exc.GitlabCreateError)
227169
def ldap_sync(self, **kwargs: Any) -> None:

0 commit comments

Comments
 (0)