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
42cb6597
Commit
42cb6597
authored
Oct 04, 2016
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update API docs and specs for /projects/visible
parent
355f97f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
doc/api/projects.md
doc/api/projects.md
+3
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+21
-2
No files found.
doc/api/projects.md
View file @
42cb6597
...
...
@@ -33,6 +33,7 @@ Parameters:
-
`order_by`
(optional) - Return requests ordered by
`id`
,
`name`
,
`path`
,
`created_at`
,
`updated_at`
or
`last_activity_at`
fields. Default is
`created_at`
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`search`
(optional) - Return list of authorized projects according to a search criteria
-
`simple`
(optional) - When set, return only the ID, URL, name, and path of each project
```
json
[
...
...
@@ -153,7 +154,7 @@ Parameters:
]
```
Get a list of projects
for
which the authenticated user can see.
Get a list of projects which the authenticated user can see.
```
GET /projects/visible
...
...
@@ -166,6 +167,7 @@ Parameters:
-
`order_by`
(optional) - Return requests ordered by
`id`
,
`name`
,
`path`
,
`created_at`
,
`updated_at`
or
`last_activity_at`
fields. Default is
`created_at`
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`search`
(optional) - Return list of authorized projects according to a search criteria
-
`simple`
(optional) - When set, return only the ID, URL, name, and path of each project
```
json
[
...
...
spec/requests/api/projects_spec.rb
View file @
42cb6597
...
...
@@ -178,11 +178,30 @@ describe API::API, api: true do
describe
'GET /projects/visible'
do
let
(
:public_project
)
{
create
(
:project
,
:public
)
}
before
do
public_project
project
project2
project3
project4
end
it
'returns the projects viewable by the user'
do
get
api
(
'/projects/visible'
,
user3
)
get
api
(
'/projects/visible'
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
map
{
|
project
|
project
[
'id'
]
}).
to
contain_exactly
(
public_project
.
id
,
project
.
id
,
project2
.
id
,
project3
.
id
)
end
it
'shows only public projects when the user only has access to those'
do
get
api
(
'/projects/visible'
,
user2
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
map
{
|
project
|
project
[
'id'
]
}).
to
contain_exactly
(
project
.
id
,
project2
.
id
,
project4
.
id
)
expect
(
json_response
.
map
{
|
project
|
project
[
'id'
]
}).
to
contain_exactly
(
public_project
.
id
)
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