summaryrefslogtreecommitdiff
path: root/gitlab/objects.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r--gitlab/objects.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py
index f8c102b..a781cb1 100644
--- a/gitlab/objects.py
+++ b/gitlab/objects.py
@@ -527,6 +527,20 @@ class User(GitlabObject):
user_id=self.id,
**kwargs)
+ def block(self, **kwargs):
+ """Blocks the user."""
+ url = '/users/%s/block' % self.id
+ r = self.gitlab._raw_put(url, **kwargs)
+ raise_error_from_response(r, GitlabBlockError)
+ self.state = 'blocked'
+
+ def unblock(self, **kwargs):
+ """Unblocks the user."""
+ url = '/users/%s/unblock' % self.id
+ r = self.gitlab._raw_put(url, **kwargs)
+ raise_error_from_response(r, GitlabUnblockError)
+ self.state = 'active'
+
class UserManager(BaseManager):
obj_cls = User