Add category resolver

What does this MR do and why?

Adds category type to group type, together with a category resolver. The resolver returns the existing categories, with fallback to the default values. In case the default values are used, it fills the namespace_id of the categories and attributes with the related group_id.

Changelog: added
EE: true

How to set up and validate locally

  1. Enable security_categories feature flag:
    Feature.enable(: security_categories_and_attributes)
  2. Use this GraphQL query to get the default values:
     query categories($fullPath: ID!) {
       group(fullPath: $fullPath) {
         id,
         securityCategories{
           name
           description
           editableState
           id
           multipleSelection
           templateType
           securityAttributes{
             name
             color
             description
             editableState
             id
           }
         }
       }
     }
  3. Use this mutation to create a category:
      mutation verify {
        securityCategoryCreate(input: {
          namespaceId: "gid://gitlab/Group/<GROUP_ID>",
          name:"This is a test",
          description:"This is a desc",
          multipleSelection: true,
        }){
          securityCategory {
            id
            name
            description
          }
        }
      }
  4. Repeat step 2 to see the new category, together with the default values.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to Add security category type to group (#562743 - closed) • Gal Katz • 18.4

Merge request reports

Loading