Add attribute create and update mutations

What does this MR do and why?

Add attribute create and update mutations

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 GraphQL to create categories:

     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
         },
         errors
       }
     }
  3. Use this GraphQL query to create attributes for the created category:

     mutation CreateSecurityAttributes {
       securityAttributeCreate(input: {
         categoryId: "gid://gitlab/Security::Category/<CATEGORY_ID>",
         attributes: [
           {     
             name: "Name",
      	      description: "Description",
             color: "#FFFFFF"
           },
           {     
             name: "Another Name",
      	      description: "Another Description",
             color: "#FFFFFF"
           }  
         ]
       }) {
         securityAttributes {
           id
           name
           description
           color
           editableState
           securityCategory {
             id
             name
           }
         }
         errors
       }
     }
  4. Use this mutation to update an attribute:

     mutation UpdateSecurityAttribute {
       securityAttributeUpdate(input: {
         id: "gid://gitlab/Security::Attribute/<ATTRIBUTE_ID>",
         name: "New Name",
         description: "New Description",
         color: "#8B0000"
       }) {
         securityAttribute {
           id
           name
           description
           color
           editableState
           securityCategory {
             id
             name
           }
         }
         errors
       }
     }

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 attributes mutations (#564817 - closed) • Gal Katz • 18.5

Edited by rossfuhrman

Merge request reports

Loading