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