Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b4b91b2c
Commit
b4b91b2c
authored
Aug 24, 2021
by
Serena Fang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update api docs
Also change error message
parent
a63fcabf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
app/services/users/banned_user_base_service.rb
app/services/users/banned_user_base_service.rb
+1
-1
doc/api/users.md
doc/api/users.md
+2
-2
locale/gitlab.pot
locale/gitlab.pot
+1
-1
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+6
-6
No files found.
app/services/users/banned_user_base_service.rb
View file @
b4b91b2c
...
@@ -33,7 +33,7 @@ module Users
...
@@ -33,7 +33,7 @@ module Users
end
end
def
state_error
(
user
)
def
state_error
(
user
)
error
(
_
(
"You cannot %{action}
a %{state} user
."
%
{
action:
action
.
to_s
,
state:
user
.
state
}),
:forbidden
)
error
(
_
(
"You cannot %{action}
%{state} users
."
%
{
action:
action
.
to_s
,
state:
user
.
state
}),
:forbidden
)
end
end
def
allowed?
def
allowed?
...
...
doc/api/users.md
View file @
b4b91b2c
...
@@ -1485,7 +1485,7 @@ Returns:
...
@@ -1485,7 +1485,7 @@ Returns:
-
`201 OK`
on success.
-
`201 OK`
on success.
-
`404 User Not Found`
if user cannot be found.
-
`404 User Not Found`
if user cannot be found.
-
`403 Forbidden`
when trying to ban a user that is
blocked by LDAP synchronization or is deactivated
.
-
`403 Forbidden`
when trying to ban a user that is
not active
.
## Unban user
## Unban user
...
@@ -1505,7 +1505,7 @@ Returns:
...
@@ -1505,7 +1505,7 @@ Returns:
-
`201 OK`
on success.
-
`201 OK`
on success.
-
`404 User Not Found`
if the user cannot be found.
-
`404 User Not Found`
if the user cannot be found.
-
`403 Forbidden`
when trying to unban a user that is
blocked by LDAP synchronization or is deactivat
ed.
-
`403 Forbidden`
when trying to unban a user that is
not bann
ed.
### Get user contribution events
### Get user contribution events
...
...
locale/gitlab.pot
View file @
b4b91b2c
...
@@ -38218,7 +38218,7 @@ msgstr ""
...
@@ -38218,7 +38218,7 @@ msgstr ""
msgid "You can view the source or %{linkStart}%{cloneIcon} clone the repository%{linkEnd}"
msgid "You can view the source or %{linkStart}%{cloneIcon} clone the repository%{linkEnd}"
msgstr ""
msgstr ""
msgid "You cannot %{action}
a %{state} user
."
msgid "You cannot %{action}
%{state} users
."
msgstr ""
msgstr ""
msgid "You cannot access the raw file. Please wait a minute."
msgid "You cannot access the raw file. Please wait a minute."
...
...
spec/requests/api/users_spec.rb
View file @
b4b91b2c
...
@@ -2989,7 +2989,7 @@ RSpec.describe API::Users do
...
@@ -2989,7 +2989,7 @@ RSpec.describe API::Users do
ban_user
ban_user
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
json_response
[
'message'
]).
to
eq
(
'You cannot ban
a ldap_blocked user
.'
)
expect
(
json_response
[
'message'
]).
to
eq
(
'You cannot ban
ldap_blocked users
.'
)
expect
(
ldap_blocked_user
.
reload
.
state
).
to
eq
(
'ldap_blocked'
)
expect
(
ldap_blocked_user
.
reload
.
state
).
to
eq
(
'ldap_blocked'
)
end
end
end
end
...
@@ -3001,7 +3001,7 @@ RSpec.describe API::Users do
...
@@ -3001,7 +3001,7 @@ RSpec.describe API::Users do
ban_user
ban_user
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
json_response
[
'message'
]).
to
eq
(
'You cannot ban
a deactivated user
.'
)
expect
(
json_response
[
'message'
]).
to
eq
(
'You cannot ban
deactivated users
.'
)
expect
(
deactivated_user
.
reload
.
state
).
to
eq
(
'deactivated'
)
expect
(
deactivated_user
.
reload
.
state
).
to
eq
(
'deactivated'
)
end
end
end
end
...
@@ -3013,7 +3013,7 @@ RSpec.describe API::Users do
...
@@ -3013,7 +3013,7 @@ RSpec.describe API::Users do
ban_user
ban_user
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
json_response
[
'message'
]).
to
eq
(
'You cannot ban
a banned user
.'
)
expect
(
json_response
[
'message'
]).
to
eq
(
'You cannot ban
banned users
.'
)
expect
(
banned_user
.
reload
.
state
).
to
eq
(
'banned'
)
expect
(
banned_user
.
reload
.
state
).
to
eq
(
'banned'
)
end
end
end
end
...
@@ -3070,7 +3070,7 @@ RSpec.describe API::Users do
...
@@ -3070,7 +3070,7 @@ RSpec.describe API::Users do
unban_user
unban_user
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
json_response
[
'message'
]).
to
eq
(
'You cannot unban
a ldap_blocked user
.'
)
expect
(
json_response
[
'message'
]).
to
eq
(
'You cannot unban
ldap_blocked users
.'
)
expect
(
ldap_blocked_user
.
reload
.
state
).
to
eq
(
'ldap_blocked'
)
expect
(
ldap_blocked_user
.
reload
.
state
).
to
eq
(
'ldap_blocked'
)
end
end
end
end
...
@@ -3082,7 +3082,7 @@ RSpec.describe API::Users do
...
@@ -3082,7 +3082,7 @@ RSpec.describe API::Users do
unban_user
unban_user
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
json_response
[
'message'
]).
to
eq
(
'You cannot unban
a deactivated user
.'
)
expect
(
json_response
[
'message'
]).
to
eq
(
'You cannot unban
deactivated users
.'
)
expect
(
deactivated_user
.
reload
.
state
).
to
eq
(
'deactivated'
)
expect
(
deactivated_user
.
reload
.
state
).
to
eq
(
'deactivated'
)
end
end
end
end
...
@@ -3094,7 +3094,7 @@ RSpec.describe API::Users do
...
@@ -3094,7 +3094,7 @@ RSpec.describe API::Users do
unban_user
unban_user
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
json_response
[
'message'
]).
to
eq
(
'You cannot unban a
active user
.'
)
expect
(
json_response
[
'message'
]).
to
eq
(
'You cannot unban a
ctive users
.'
)
expect
(
user
.
reload
.
state
).
to
eq
(
'active'
)
expect
(
user
.
reload
.
state
).
to
eq
(
'active'
)
end
end
end
end
...
...
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