Read about our upcoming Code of Conduct on this issue

This instance was upgraded to Heptapod 0.28.0 today

Unverified Commit 746ac56b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Add functionality to setup share of project with group via project settings

Signed-off-by: default avatarDmitriy Zaporozhets <>
parent de2ba7e7826a
......@@ -103,6 +103,8 @@ class Dispatcher
new ProjectFork()
when 'projects:artifacts:browse'
new BuildArtifacts()
when 'projects:group_links:index'
new GroupsSelect()
switch path.first()
when 'admin'
class Projects::GroupLinksController < Projects::ApplicationController
layout 'project_settings'
before_action :authorize_admin_project!
def index
@group_links = project.project_group_links.all
def create
link =
link.group_id = params[:link_group_id]
link.group_access = params[:link_group_access]
redirect_to namespace_project_group_links_path(project.namespace, project)
def destroy
redirect_to namespace_project_group_links_path(project.namespace, project)
......@@ -880,6 +880,11 @@ def jira_tracker_active?
jira_tracker? &&
def allowed_to_share_with_group?
# TODO: replace with logic
def ci_commit(sha)
ci_commits.find_by(sha: sha)
......@@ -13,6 +13,12 @@
= icon('pencil-square-o fw')
Project Settings
- if @project.allowed_to_share_with_group?
= nav_link(controller: :group_links) do
= link_to namespace_project_group_links_path(@project.namespace, @project), title: "Groups" do
= icon('share-square-o fw')
= nav_link(controller: :deploy_keys) do
= link_to namespace_project_deploy_keys_path(@project.namespace, @project), title: 'Deploy Keys' do
= icon('key fw')
- page_title "Groups"
%h3.page_title Share project with other groups
Projects can be stored in only one group at once. However you can share a project with other groups here.
- if @group_links.present?
Already shared with
- @group_links.each do |group_link|
- group =
= link_to namespace_project_group_link_path(@project.namespace, @project, group_link), method: :delete, class: 'btn btn-sm' do
disable sharing
= link_to group do
.light up to #{group_link.human_access}
Can be shared with
= form_tag namespace_project_group_links_path(@project.namespace, @project), method: :post, class: 'form-horizontal' do
= label_tag :link_group_id, 'Group', class: 'control-label'
= groups_select_tag(:link_group_id, skip_group:
= label_tag :link_group_access, 'Max access level', class: 'control-label'
= select_tag :link_group_access, options_for_select(ProjectGroupLink.access_options, ProjectGroupLink.default_access), class: "form-control"
= submit_tag "Share", class: "btn btn-create"
......@@ -701,6 +701,8 @@
resources :group_links, only: [:index, :create, :destroy], constraints: { id: /\d+/ }
resources :notes, only: [:index, :create, :destroy, :update], constraints: { id: /\d+/ } do
member do
delete :delete_attachment
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