Expose projects with integration overrides
What does this MR do?
This MR exposes a JSON endpoint of projects that are using different integration settings other than what has been set on the instance admin-level. A frontend MR will later consume the data #218252 (closed).
Walking through the QA steps should help to explain the feature
QA
- Visit your instance admin's integration settings (
/admin/application_settings/integrations
), and configure theCampfire
integration (we use Campfire in this example because it's a simple integration; it requires atoken
to be provided - just enter anything). - Visit a project's Campfire integration settings (
/<project-full-path>/-/services/campfire/edit
) and change the drop-down toUse custom settings
. Save the integration (you don't need to change anything else in the form). - Visit the JSON endpoint for Campfire overrides (
/admin/application_settings/integrations/campfire/overrides.json
) and the project should appear in the list. - Edit the project's Campfire integration again, this time change the drop-down to
Use default settings
. Save the integration. - Visit the JSON endpoint for Campfire overrides and the project should not appear.
Example JSON output
[
{
"avatar_url": null,
"full_name": "Administrator / test",
"name": "test",
"full_path": "/root/test"
}
]
Example queries
We're using ConfluenceService
here as the example integration type.
The queries produced by changes in Admin::IntegrationsController#overrides
are:
The paginator count query (link to #database-lab
result):
SELECT
COUNT(*)
FROM
(
SELECT
1 AS one
FROM
"projects"
INNER JOIN
"integrations"
ON "integrations"."project_id" = "projects"."id"
WHERE
"integrations"."type" = 'ConfluenceService'
AND "integrations"."active" = TRUE
AND "integrations"."inherit_from_id" IS NULL LIMIT 10001
)
subquery_for_count
The results query (link to #database-lab
result)::
SELECT
"projects".*
FROM
"projects"
INNER JOIN
"integrations"
ON "integrations"."project_id" = "projects"."id"
WHERE
"integrations"."type" = 'ConfluenceService'
AND "integrations"."active" = TRUE
AND "integrations"."inherit_from_id" IS NULL
ORDER BY
"projects"."id" ASC LIMIT 20 OFFSET 0
Does this MR meet the acceptance criteria?
Conformity
- [-] I have included changelog trailers, or none are needed. (Does this MR need a changelog?)
- [-] I have added/updated documentation, or it's not needed. (Is documentation required?)
- [-] I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?)
-
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) - [-] I have tested this MR in all supported browsers, or it's not needed.
- [-] I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
Related to #218252 (closed)
Edited by Luke Duncalfe