Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
go-gitlab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
go-gitlab
Commits
35a62c4c
Commit
35a62c4c
authored
Mar 17, 2016
by
Peter Mikula
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix (un)block user api call
parent
c7d77110
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
users.go
users.go
+11
-12
No files found.
users.go
View file @
35a62c4c
...
@@ -18,6 +18,7 @@ package gitlab
...
@@ -18,6 +18,7 @@ package gitlab
import
(
import
(
"fmt"
"fmt"
"io/ioutil"
"time"
"time"
)
)
...
@@ -396,39 +397,37 @@ func (s *UsersService) DeleteSSHKeyForUser(user int, kid int) (*Response, error)
...
@@ -396,39 +397,37 @@ func (s *UsersService) DeleteSSHKeyForUser(user int, kid int) (*Response, error)
// BlockUser blocks the specified user. Available only for admin.
// BlockUser blocks the specified user. Available only for admin.
//
//
// GitLab API docs: http://doc.gitlab.com/ce/api/users.html#block-user
// GitLab API docs: http://doc.gitlab.com/ce/api/users.html#block-user
func
(
s
*
UsersService
)
BlockUser
(
user
int
)
(
*
User
,
*
Response
,
error
)
{
func
(
s
*
UsersService
)
BlockUser
(
user
int
)
(
*
Response
,
error
)
{
u
:=
fmt
.
Sprintf
(
"users/%d/block"
,
user
)
u
:=
fmt
.
Sprintf
(
"users/%d/block"
,
user
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
nil
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
err
}
}
usr
:=
new
(
User
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
ioutil
.
Discard
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
usr
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
resp
,
err
return
resp
,
err
}
}
return
usr
,
resp
,
err
return
resp
,
err
}
}
// UnblockUser unblocks the specified user. Available only for admin.
// UnblockUser unblocks the specified user. Available only for admin.
//
//
// GitLab API docs: http://doc.gitlab.com/ce/api/users.html#unblock-user
// GitLab API docs: http://doc.gitlab.com/ce/api/users.html#unblock-user
func
(
s
*
UsersService
)
UnblockUser
(
user
int
)
(
*
User
,
*
Response
,
error
)
{
func
(
s
*
UsersService
)
UnblockUser
(
user
int
)
(
*
Response
,
error
)
{
u
:=
fmt
.
Sprintf
(
"users/%d/unblock"
,
user
)
u
:=
fmt
.
Sprintf
(
"users/%d/unblock"
,
user
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
nil
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
err
}
}
usr
:=
new
(
User
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
ioutil
.
Discard
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
usr
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
resp
,
err
return
resp
,
err
}
}
return
usr
,
resp
,
err
return
resp
,
err
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment