Commit 66b6d82a authored by Grzegorz Bizon's avatar Grzegorz Bizon

Use guard clause to check ability to share project

parent d177abb3
...@@ -8,14 +8,11 @@ class Projects::GroupLinksController < Projects::ApplicationController ...@@ -8,14 +8,11 @@ class Projects::GroupLinksController < Projects::ApplicationController
def create def create
group = Group.find(params[:link_group_id]) group = Group.find(params[:link_group_id])
return render_404 unless can?(current_user, :read_group, group)
if can?(current_user, :read_group, group) project.project_group_links.create(
project.project_group_links.create( group: group, group_access: params[:link_group_access]
group: group, group_access: params[:link_group_access] )
)
else
return render_404
end
redirect_to namespace_project_group_links_path(project.namespace, project) redirect_to namespace_project_group_links_path(project.namespace, project)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment