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
Léo-Paul Géneau
gitlab-ce
Commits
7308a9be
Commit
7308a9be
authored
Aug 09, 2018
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: Add shared project's expiration date
parent
cc9764ac
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
2 deletions
+27
-2
changelogs/unreleased/api-shared_group_expires-at.yml
changelogs/unreleased/api-shared_group_expires-at.yml
+5
-0
doc/api/groups.md
doc/api/groups.md
+4
-2
lib/api/entities.rb
lib/api/entities.rb
+1
-0
spec/factories/project_group_links.rb
spec/factories/project_group_links.rb
+1
-0
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+16
-0
No files found.
changelogs/unreleased/api-shared_group_expires-at.yml
0 → 100644
View file @
7308a9be
---
title
:
'
API:
Add
expiration
date
for
shared
projects
to
the
project
entity'
merge_request
:
21104
author
:
Robert Schilling
type
:
added
doc/api/groups.md
View file @
7308a9be
...
...
@@ -351,12 +351,14 @@ Example response:
{
"group_id"
:
4
,
"group_name"
:
"Twitter"
,
"group_access_level"
:
30
"group_access_level"
:
30
,
"expires_at"
:
null
},
{
"group_id"
:
3
,
"group_name"
:
"Gitlab Org"
,
"group_access_level"
:
10
"group_access_level"
:
10
,
"expires_at"
:
"2018-08-14"
}
]
}
...
...
lib/api/entities.rb
View file @
7308a9be
...
...
@@ -91,6 +91,7 @@ module API
group_link
.
group
.
name
end
expose
:group_access
,
as: :group_access_level
expose
:expires_at
end
class
ProjectIdentity
<
Grape
::
Entity
...
...
spec/factories/project_group_links.rb
View file @
7308a9be
...
...
@@ -2,5 +2,6 @@ FactoryBot.define do
factory
:project_group_link
do
project
group
expires_at
nil
end
end
spec/requests/api/projects_spec.rb
View file @
7308a9be
...
...
@@ -914,12 +914,28 @@ describe API::Projects do
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_id'
]).
to
eq
(
group
.
id
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_name'
]).
to
eq
(
group
.
name
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_access_level'
]).
to
eq
(
link
.
group_access
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'expires_at'
]).
to
be_nil
expect
(
json_response
[
'only_allow_merge_if_pipeline_succeeds'
]).
to
eq
(
project
.
only_allow_merge_if_pipeline_succeeds
)
expect
(
json_response
[
'only_allow_merge_if_all_discussions_are_resolved'
]).
to
eq
(
project
.
only_allow_merge_if_all_discussions_are_resolved
)
expect
(
json_response
[
'merge_method'
]).
to
eq
(
project
.
merge_method
.
to_s
)
expect
(
json_response
[
'readme_url'
]).
to
eq
(
project
.
readme_url
)
end
it
'returns a group link with expiration date'
do
group
=
create
(
:group
)
expires_at
=
5
.
days
.
from_now
.
to_date
link
=
create
(
:project_group_link
,
project:
project
,
group:
group
,
expires_at:
expires_at
)
get
api
(
"/projects/
#{
project
.
id
}
"
,
user
)
expect
(
json_response
[
'shared_with_groups'
]).
to
be_an
Array
expect
(
json_response
[
'shared_with_groups'
].
length
).
to
eq
(
1
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_id'
]).
to
eq
(
group
.
id
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_name'
]).
to
eq
(
group
.
name
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_access_level'
]).
to
eq
(
link
.
group_access
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'expires_at'
]).
to
eq
(
expires_at
.
to_s
)
end
it
'returns a project by path name'
do
get
api
(
"/projects/
#{
project
.
id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
...
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