@@ -1467,6 +1467,46 @@ def ldap_sync(self, **kwargs):
1467
1467
path = "/groups/%s/ldap_sync" % self .get_id ()
1468
1468
self .manager .gitlab .http_post (path , ** kwargs )
1469
1469
1470
+ @cli .register_custom_action (
1471
+ "Group" , ("group_id" , "group_access" ), ("expires_at" ,)
1472
+ )
1473
+ @exc .on_http_error (exc .GitlabCreateError )
1474
+ def share (self , group_id , group_access , expires_at = None , ** kwargs ):
1475
+ """Share the group with a group.
1476
+
1477
+ Args:
1478
+ group_id (int): ID of the group.
1479
+ group_access (int): Access level for the group.
1480
+ **kwargs: Extra options to send to the server (e.g. sudo)
1481
+
1482
+ Raises:
1483
+ GitlabAuthenticationError: If authentication is not correct
1484
+ GitlabCreateError: If the server failed to perform the request
1485
+ """
1486
+ path = "/groups/%s/share" % self .get_id ()
1487
+ data = {
1488
+ "group_id" : group_id ,
1489
+ "group_access" : group_access ,
1490
+ "expires_at" : expires_at ,
1491
+ }
1492
+ self .manager .gitlab .http_post (path , post_data = data , ** kwargs )
1493
+
1494
+ @cli .register_custom_action ("Group" , ("group_id" ,))
1495
+ @exc .on_http_error (exc .GitlabDeleteError )
1496
+ def unshare (self , group_id , ** kwargs ):
1497
+ """Delete a shared group link within a group.
1498
+
1499
+ Args:
1500
+ group_id (int): ID of the group.
1501
+ **kwargs: Extra options to send to the server (e.g. sudo)
1502
+
1503
+ Raises:
1504
+ GitlabAuthenticationError: If authentication is not correct
1505
+ GitlabDeleteError: If the server failed to perform the request
1506
+ """
1507
+ path = "/groups/%s/share/%s" % (self .get_id (), group_id )
1508
+ self .manager .gitlab .http_delete (path , ** kwargs )
1509
+
1470
1510
1471
1511
class GroupManager (CRUDMixin , RESTManager ):
1472
1512
_path = "/groups"
0 commit comments