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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
5fb57241
Commit
5fb57241
authored
Apr 12, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix minor issues according development guidelines
parent
d0cdc2ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
11 deletions
+17
-11
doc/api/groups.md
doc/api/groups.md
+1
-1
lib/api/groups.rb
lib/api/groups.rb
+4
-6
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+12
-4
No files found.
doc/api/groups.md
View file @
5fb57241
...
@@ -140,7 +140,7 @@ PUT /groups/:id
...
@@ -140,7 +140,7 @@ PUT /groups/:id
|
`name`
| string | no | The name of the group |
|
`name`
| string | no | The name of the group |
|
`path`
| string | no | The path of the group |
|
`path`
| string | no | The path of the group |
|
`description`
| string | no | The description of the group |
|
`description`
| string | no | The description of the group |
|
`visibility_level`
| integer | no | The visibility
_
level of the group. 0 for private, 10 for internal, 20 for public. |
|
`visibility_level`
| integer | no | The visibility
level of the group. 0 for private, 10 for internal, 20 for public. |
```
bash
```
bash
curl
-X
PUT
-H
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
"https://gitlab.example.com/api/v3/groups/5?name=Experimental"
curl
-X
PUT
-H
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
"https://gitlab.example.com/api/v3/groups/5?name=Experimental"
...
...
lib/api/groups.rb
View file @
5fb57241
...
@@ -47,7 +47,7 @@ module API
...
@@ -47,7 +47,7 @@ module API
# Update group. Available only for users who can administrate groups.
# Update group. Available only for users who can administrate groups.
#
#
# Parameters:
# Parameters:
# id (required)
- The ID of a group
# id (required) - The ID of a group
# path (optional) - The path of the group
# path (optional) - The path of the group
# description (optional) - The description of the group
# description (optional) - The description of the group
# visibility_level (optional) - The visibility level of the group
# visibility_level (optional) - The visibility level of the group
...
@@ -59,12 +59,10 @@ module API
...
@@ -59,12 +59,10 @@ module API
attrs
=
attributes_for_keys
[
:name
,
:path
,
:description
,
:visibility_level
]
attrs
=
attributes_for_keys
[
:name
,
:path
,
:description
,
:visibility_level
]
::
Groups
::
UpdateService
.
new
(
group
,
current_user
,
attrs
).
execute
if
::
Groups
::
UpdateService
.
new
(
group
,
current_user
,
attrs
).
execute
if
group
.
errors
.
any?
render_validation_error!
(
group
)
else
present
group
,
with:
Entities
::
GroupDetail
present
group
,
with:
Entities
::
GroupDetail
else
render_validation_error!
(
group
)
end
end
end
end
...
...
spec/requests/api/groups_spec.rb
View file @
5fb57241
...
@@ -100,7 +100,7 @@ describe API::API, api: true do
...
@@ -100,7 +100,7 @@ describe API::API, api: true do
describe
'PUT /groups/:id'
do
describe
'PUT /groups/:id'
do
let
(
:new_group_name
)
{
'New Group'
}
let
(
:new_group_name
)
{
'New Group'
}
context
"when authenticated the group owner"
do
context
'when authenticated as the group owner'
do
it
'updates the group'
do
it
'updates the group'
do
put
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
),
name:
new_group_name
put
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
),
name:
new_group_name
...
@@ -115,7 +115,7 @@ describe API::API, api: true do
...
@@ -115,7 +115,7 @@ describe API::API, api: true do
end
end
end
end
context
"when authenticated the admin"
do
context
'when authenticated as the admin'
do
it
'updates the group'
do
it
'updates the group'
do
put
api
(
"/groups/
#{
group1
.
id
}
"
,
admin
),
name:
new_group_name
put
api
(
"/groups/
#{
group1
.
id
}
"
,
admin
),
name:
new_group_name
...
@@ -124,13 +124,21 @@ describe API::API, api: true do
...
@@ -124,13 +124,21 @@ describe API::API, api: true do
end
end
end
end
context
"when authenticated an user"
do
context
'when authenticated as an user that can see the group'
do
it
'updates the group'
do
it
'
does not
updates the group'
do
put
api
(
"/groups/
#{
group1
.
id
}
"
,
user2
),
name:
new_group_name
put
api
(
"/groups/
#{
group1
.
id
}
"
,
user2
),
name:
new_group_name
expect
(
response
.
status
).
to
eq
(
403
)
expect
(
response
.
status
).
to
eq
(
403
)
end
end
end
end
context
'when authenticated as an user that cannot see the group'
do
it
'returns 403 when trying to update the group'
do
put
api
(
"/groups/
#{
group2
.
id
}
"
,
user1
),
name:
new_group_name
expect
(
response
.
status
).
to
eq
(
403
)
end
end
end
end
describe
"GET /groups/:id/projects"
do
describe
"GET /groups/:id/projects"
do
...
...
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