|
5 | 5 | importgitlab |
6 | 6 | fromgitlabimportcli |
7 | 7 | fromgitlabimportexceptionsasexc |
8 | | -fromgitlabimporttypes,utils |
| 8 | +fromgitlabimporttypes |
9 | 9 | fromgitlab.baseimportRESTManager,RESTObject |
10 | 10 | fromgitlab.mixinsimport ( |
11 | 11 | CreateMixin, |
@@ -164,64 +164,6 @@ def search( |
164 | 164 | path=f"/groups/{self.encoded_id}/search" |
165 | 165 | returnself.manager.gitlab.http_list(path,query_data=data,**kwargs) |
166 | 166 |
|
167 | | -@cli.register_custom_action("Group", ("cn","group_access","provider")) |
168 | | -@exc.on_http_error(exc.GitlabCreateError) |
169 | | -defadd_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 | | -defdelete_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 | | -ifproviderisnotNone: |
221 | | -path+=f"/{provider}" |
222 | | -path+=f"/{cn}" |
223 | | -self.manager.gitlab.http_delete(path,**kwargs) |
224 | | - |
225 | 167 | @cli.register_custom_action("Group") |
226 | 168 | @exc.on_http_error(exc.GitlabCreateError) |
227 | 169 | defldap_sync(self,**kwargs:Any)->None: |
|