@@ -807,6 +807,61 @@ def search(self, scope, search, **kwargs):
807
807
path = '/groups/%d/search' % self .get_id ()
808
808
return self .manager .gitlab .http_list (path , query_data = data , ** kwargs )
809
809
810
+ @cli .register_custom_action ('Group' , ('cn' , 'group_access' , 'provider' ))
811
+ @exc .on_http_error (exc .GitlabCreateError )
812
+ def add_ldap_group_link (self , cn , group_access , provider , ** kwargs ):
813
+ """Add an LDAP group link.
814
+
815
+ Args:
816
+ cn (str): CN of the LDAP group
817
+ group_access (int): Minimum access level for members of the LDAP
818
+ group
819
+ provider (str): LDAP provider for the LDAP group
820
+ **kwargs: Extra options to send to the Gitlab server (e.g. sudo)
821
+
822
+ Raises:
823
+ GitlabAuthenticationError: If authentication is not correct
824
+ GitlabCreateError: If the server cannot perform the request
825
+ """
826
+ path = '/groups/%d/ldap_group_links' % self .get_id ()
827
+ data = {'cn' : cn , 'group_access' : group_access , 'provider' : provider }
828
+ self .manager .gitlab .http_post (path , post_data = data , ** kwargs )
829
+
830
+ @cli .register_custom_action ('Group' , ('cn' ,), ('provider' ,))
831
+ @exc .on_http_error (exc .GitlabDeleteError )
832
+ def delete_ldap_group_link (self , cn , provider = None , ** kwargs ):
833
+ """Delete an LDAP group link.
834
+
835
+ Args:
836
+ cn (str): CN of the LDAP group
837
+ provider (str): LDAP provider for the LDAP group
838
+ **kwargs: Extra options to send to the Gitlab server (e.g. sudo)
839
+
840
+ Raises:
841
+ GitlabAuthenticationError: If authentication is not correct
842
+ GitlabDeleteError: If the server cannot perform the request
843
+ """
844
+ path = '/groups/%d/ldap_group_links' % self .get_id ()
845
+ if provider is not None :
846
+ path += '/%s' % provider
847
+ path += '/%s' % cn
848
+ self .manager .gitlab .http_delete (path )
849
+
850
+ @cli .register_custom_action ('Group' )
851
+ @exc .on_http_error (exc .GitlabCreateError )
852
+ def ldap_sync (self , ** kwargs ):
853
+ """Sync LDAP groups.
854
+
855
+ Args:
856
+ **kwargs: Extra options to send to the Gitlab server (e.g. sudo)
857
+
858
+ Raises:
859
+ GitlabAuthenticationError: If authentication is not correct
860
+ GitlabCreateError: If the server cannot perform the request
861
+ """
862
+ path = '/groups/%d/ldap_sync' % self .get_id ()
863
+ self .manager .gitlab .http_post (path , ** kwargs )
864
+
810
865
811
866
class GroupManager (CRUDMixin , RESTManager ):
812
867
_path = '/groups'
0 commit comments