@@ -735,4 +735,76 @@ public void removeMember(Integer groupId, Integer userId) throws GitLabApiExcept
735735 Response .Status expectedStatus = (isApiVersion (ApiVersion .V3 ) ? Response .Status .OK : Response .Status .NO_CONTENT );
736736 delete (expectedStatus , null , "groups" , groupId , "members" , userId );
737737 }
738+
739+ /**
740+ * Syncs the group with its linked LDAP group. Only available to group owners and administrators.
741+ *
742+ * <pre><code>GitLab Endpoint: POST /groups/:id/ldap_sync</code></pre>
743+ *
744+ * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
745+ * @throws GitLabApiException if any exception occurs
746+ */
747+ public void ldapSync (Object groupIdOrPath ) throws GitLabApiException {
748+ post (Response .Status .NO_CONTENT , (Form )null , "groups" , getGroupIdOrPath (groupIdOrPath ), "ldap_sync" );
749+ }
750+
751+ /**
752+ * Adds an LDAP group link.
753+ *
754+ * <pre><code>GitLab Endpoint: POST /groups/:id/ldap_group_links</code></pre>
755+ *
756+ * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
757+ * @param cn the CN of a LDAP group
758+ * @param groupAccess the minimum access level for members of the LDAP group
759+ * @param provider the LDAP provider for the LDAP group
760+ * @throws GitLabApiException if any exception occurs
761+ */
762+ public void addLdapGroupLink (Object groupIdOrPath , String cn , AccessLevel groupAccess , String provider ) throws GitLabApiException {
763+ GitLabApiForm formData = new GitLabApiForm ()
764+ .withParam ("cn" , cn , true )
765+ .withParam ("group_Access" , groupAccess , true )
766+ .withParam ("provider" , provider , true );
767+ post (Response .Status .NO_CONTENT , formData , "groups" , getGroupIdOrPath (groupIdOrPath ), "ldap_group_links" );
768+ }
769+
770+ /**
771+ * Deletes an LDAP group link.
772+ *
773+ * <pre><code>GitLab Endpoint: DELETE /groups/:id/ldap_group_links/:cn</code></pre>
774+ *
775+ * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
776+ * @param cn the CN of the LDAP group link to delete
777+ * @throws GitLabApiException if any exception occurs
778+ */
779+ public void deleteLdapGroupLink (Object groupIdOrPath , String cn ) throws GitLabApiException {
780+
781+ if (cn == null || cn .trim ().isEmpty ()) {
782+ throw new RuntimeException ("cn cannot be null or empty" );
783+ }
784+
785+ delete (Response .Status .OK , null , "groups" , getGroupIdOrPath (groupIdOrPath ), "ldap_group_links" , cn );
786+ }
787+
788+ /**
789+ * Deletes an LDAP group link for a specific LDAP provider.
790+ *
791+ * <pre><code>GitLab Endpoint: DELETE /groups/:id/ldap_group_links/:provider/:cn</code></pre>
792+ *
793+ * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
794+ * @param cn the CN of the LDAP group link to delete
795+ * @param provider the name of the LDAP provider
796+ * @throws GitLabApiException if any exception occurs
797+ */
798+ public void deleteLdapGroupLink (Object groupIdOrPath , String cn , String provider ) throws GitLabApiException {
799+
800+ if (cn == null || cn .trim ().isEmpty ()) {
801+ throw new RuntimeException ("cn cannot be null or empty" );
802+ }
803+
804+ if (provider == null || provider .trim ().isEmpty ()) {
805+ throw new RuntimeException ("LDAP provider cannot be null or empty" );
806+ }
807+
808+ delete (Response .Status .OK , null , "groups" , getGroupIdOrPath (groupIdOrPath ), "ldap_group_links" , provider , cn );
809+ }
738810}
0 commit comments