Commit 36cb80da authored by Sean McGivern's avatar Sean McGivern

Merge branch '8902-jira-dvcs-instance-admin' into 'master'

Allow instance admins to setup Jira DVCS integration for all projects

Closes #8902

See merge request gitlab-org/gitlab-ee!10541
parents 39d4ee8c f755a5ff
......@@ -20,7 +20,7 @@ is one GitLab project to the entire Jira instance.
We recommend that a GitLab group admin
or instance admin (in the case of self-hosted GitLab) set up the integration,
in order to simplify administration (subject to [limitations](#limitations)).
in order to simplify administration.
TIP: **Tip:**
Create and use a single-purpose "jira" user in GitLab, so that removing
......@@ -123,8 +123,6 @@ Click the links to see your GitLab repository data.
## Limitations
- This integration is currently not supported on GitLab instances under a [relative url][relative-url] (e.g. `http://example.com/gitlab`).
- The GitLab user that you use to configure this integration must be a member of all
projects you wish to link to Jira. We're investigating removing this limitation in in [a feature proposal](https://gitlab.com/gitlab-org/gitlab-ee/issues/8902).
## Changelog
......
---
title: Allow instance admins to link all projects to Jira DVCS
merge_request: 10541
author:
type: added
......@@ -105,17 +105,19 @@ module API
params do
use :pagination
end
# rubocop: disable CodeReuse/ActiveRecord
get ':namespace/repos', requirements: NAMESPACE_ENDPOINT_REQUIREMENTS do
namespace = Namespace.find_by_full_path(params[:namespace])
not_found!('Namespace') unless namespace
projects = current_user.authorized_projects.where(namespace_id: namespace.self_and_descendants).to_a
projects = Project.public_or_visible_to_user(current_user)
.in_namespace(namespace.self_and_descendants)
.to_a
projects.select! { |project| licensed_project?(project) }
projects = ::Kaminari.paginate_array(projects)
present paginate(projects), with: ::API::Github::Entities::Repository
end
# rubocop: enable CodeReuse/ActiveRecord
end
# Jira dev panel integration weirdly requests for "/-/jira/pulls" instead
......
......@@ -242,6 +242,18 @@ describe API::V3::Github do
expect(json_response.size).to eq(projects.size)
end
context 'when instance admin' do
let(:project) { create(:project, group: group) }
before do
stub_licensed_features(jira_dev_panel_integration: true)
end
it 'returns an array of projects belonging to group with github format' do
expect_project_under_namespace([project], group, create(:user, :admin))
end
end
context 'group namespace' do
let(:project) { create(:project, group: group) }
......
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