Skip to content

Core backports from the Premium license templates feature

Nick Thomas requested to merge (removed):backport-5986-license-templates into master

What does this MR do?

Backports a number of changes to license template handling from https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/6631

Chiefly, since license templates may now come from a range of sources, we introduce our own model (::LicenseTemplate), and a finder (::LicenseTemplateFinder), which work together to query all those sources. Two sites are then changed to use these finders instead of Licensee::License:

  • Helper method: licenses_for_select
  • API endpoint: /api/v4/templates/licenses[/:name]

In Core, the only source is the existing Licensee::License.all set of licenses. So this is a re-organisation, but effectively a no-operation.

In Premium, we add an instance-wide "custom file templates project" setting, which can hold additional license templates that operate instance-wide.

In the future, we may wish to add group license templates or further sources of licenses. Keeping all the logic for that in a Finder means we don't have to repeat it across the various sites that need to display licenses.

There are also a number of preparatory commits:

  • ffd164d2 fixes a number of small bugs preventing Gitlab::Template::BaseTemplate.all from building instances that can read template content
  • b68d6470 enhances project_select_tag with functionality used in the EE admin panel
  • 239b7843 adds the necessary JS to /admin/application_settings for project_select_tag to work, along with a render_if_exists for EE-specific template settings. It's used in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/6631

What are the relevant issue numbers?

Does this MR meet the acceptance criteria?

Edited by Nick Thomas

Merge request reports

Loading