diff options
author | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-09-30 12:58:41 +0000 |
---|---|---|
committer | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-09-30 12:58:41 +0000 |
commit | 91a91557ce4aeeafa34856009359bb6c34e3e10e (patch) | |
tree | b8b712de74856645d9c4a97faff47dbd7f6cde08 /lib/api/projects.rb | |
parent | 5838d1ba892872553dcd4e3945a3fab8faf339a4 (diff) | |
parent | b9daced7a2814fa74a3f0dddf38858100678c6b1 (diff) | |
download | gitlab-ce-91a91557ce4aeeafa34856009359bb6c34e3e10e.tar.gz |
Merge branch 'master' into 'fix_oauth_doc'
# Conflicts:
# doc/api/oauth2.md
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r-- | lib/api/projects.rb | 11 |
1 files changed, 6 insertions, 5 deletions
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 |