@@ -282,7 +282,43 @@ def activate(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
282
282
if server_data :
283
283
self ._attrs ["state" ] = "active"
284
284
return server_data
285
+
286
+ @cli .register_custom_action ("User" )
287
+ @exc .on_http_error (exc .GitlabApproveError )
288
+ def approve (self , ** kwargs : Any ) -> Union [Dict [str , Any ], requests .Response ]:
289
+ """Approve a user creation request.
290
+
291
+ Args:
292
+ **kwargs: Extra options to send to the server (e.g. sudo)
285
293
294
+ Raises:
295
+ GitlabAuthenticationError: If authentication is not correct
296
+ GitlabActivateError: If the user could not be activated
297
+
298
+ Returns:
299
+ The new object data (*not* a RESTObject)
300
+ """
301
+ path = f"/users/{ self .encoded_id } /approve"
302
+ return self .manager .gitlab .http_post (path , ** kwargs )
303
+
304
+ @cli .register_custom_action ("User" )
305
+ @exc .on_http_error (exc .GitlabRejectError )
306
+ def reject (self , ** kwargs : Any ) -> Union [Dict [str , Any ], requests .Response ]:
307
+ """Reject a user creation request.
308
+
309
+ Args:
310
+ **kwargs: Extra options to send to the server (e.g. sudo)
311
+
312
+ Raises:
313
+ GitlabAuthenticationError: If authentication is not correct
314
+ GitlabActivateError: If the user could not be activated
315
+
316
+ Returns:
317
+ The new object data (*not* a RESTObject)
318
+ """
319
+ path = f"/users/{ self .encoded_id } /reject"
320
+ return self .manager .gitlab .http_post (path , ** kwargs )
321
+
286
322
287
323
class UserManager (CRUDMixin , RESTManager ):
288
324
_path = "/users"
0 commit comments