diff options
author | Felipe Artur <felipefac@gmail.com> | 2016-09-22 17:31:18 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-09-28 10:12:49 -0300 |
commit | 93d849beaebb00dc4dcb6cb5ffa4721883e0da51 (patch) | |
tree | 65d716820bc07f684e3629ca88815906603dafdb /lib | |
parent | 00a7ca746946fe590b077a4d50232aa862282aee (diff) | |
download | gitlab-ce-93d849beaebb00dc4dcb6cb5ffa4721883e0da51.tar.gz |
Expose project share expiration_date field on APIissue_22382
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/api/projects.rb | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 92a6f29adb0..29ad9f3565a 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -343,7 +343,7 @@ module API end class ProjectGroupLink < Grape::Entity - expose :id, :project_id, :group_id, :group_access + expose :id, :project_id, :group_id, :group_access, :expires_at end class Todo < Grape::Entity diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 6d99617b56f..680055c95eb 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -393,23 +393,24 @@ module API # Share project with group # # Parameters: - # id (required) - The ID of a project - # group_id (required) - The ID of a group + # id (required) - The ID of a project + # group_id (required) - The ID of a group # group_access (required) - Level of permissions for sharing + # expires_at (optional) - Share expiration date # # Example Request: # POST /projects/:id/share post ":id/share" do authorize! :admin_project, user_project required_attributes! [:group_id, :group_access] + attrs = attributes_for_keys [:group_id, :group_access, :expires_at] unless user_project.allowed_to_share_with_group? return render_api_error!("The project sharing with group is disabled", 400) end - link = user_project.project_group_links.new - link.group_id = params[:group_id] - link.group_access = params[:group_access] + link = user_project.project_group_links.new(attrs) + if link.save present link, with: Entities::ProjectGroupLink else |