Skip to content

Commit 4c0ddba

Browse files
author
Matt Humphrey
committed
Added methods to update and remove users
1 parent 4b4d796 commit 4c0ddba

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

lib/Gitlab/Api/Users.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ public function create($email, $password, array $params = array())
3636
return $this->post('users', $params);
3737
}
3838

39+
public function update($id, array $params)
40+
{
41+
return $this->put('users/'.urlencode($id), $params);
42+
}
43+
44+
public function remove($id)
45+
{
46+
return $this->delete('users/'.urlencode($id));
47+
}
48+
3949
public function session($email, $password)
4050
{
4151
return $this->post('session', array(

lib/Gitlab/Model/User.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ public function show()
6161
return User::fromArray($this->getClient(), $data);
6262
}
6363

64+
public function update(array $params)
65+
{
66+
$data = $this->api('users')->update($this->id, $params);
67+
68+
return User::fromArray($this->getClient(), $data);
69+
}
70+
71+
public function remove()
72+
{
73+
$this->api('users')->remove($this->id);
74+
75+
return true;
76+
}
77+
6478
public function keys()
6579
{
6680
$data = $this->api('users')->keys();

0 commit comments

Comments
 (0)