Add mutation for attaching and detaching attributes to and from project

What does this MR do and why?

Add a mutation for attaching and detaching attributes to and from project

Changelog: added
EE: true

How to set up and validate locally

  1. Enable security_categories_and_attributes feature flag:
    Feature.enable(: security_categories_and_attributes)
  2. Use this query to attach the predefiend attributes (and create default categories on the fly):
    mutation test {
      securityAttributeProjectUpdate(input:{
        projectId: "gid://gitlab/Project/<PROJECT_ID>",
        attributeTemplateTypes: [MISSION_CRITICAL]
      }){
        addedCount
        removedCount
      }
    }
  3. Use the queries in this MR to create more categories and attributes.
  4. Use this query to get other existingc ategories and attributes:
    query categories($fullPath: ID!) {
       group(fullPath: $fullPath) {
         id,
         securityCategories{
           name
           description
           editableState
           id
           multipleSelection
           templateType
           securityAttributes{
             name
             color
             description
             editableState
             id
           }
         }
       }
     }
  5. Use this query to add and remove attributes to a project by id:
    mutation test {
      securityAttributeProjectUpdate(input:{
        projectId: "gid://gitlab/Project/<PROJECT_ID>",
        addAttributeIds: ["gid://gitlab/Security::Attribute/<ATTRIBUTE_ID>"],
        removeAttributeIds: ["gid://gitlab/Security::Attribute/<ATTRIBUTE_ID>"]
        
      }){
        addedCount
        removedCount
      }
    }
  6. Repeat the previous step with multiple selection category and multiple matching attributes.

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 attribute attach and detach mutations (#567231 - closed) • Gal Katz • 18.5

Edited by rossfuhrman

Merge request reports

Loading