Returning multiple compliance frameworks in project api
What does this MR do and why?
With support of multiple compliance frameworks for projects, we need to return all the frameworks associated with the project in the REST API too.
Database
Query
Query plan: https://postgres.ai/console/gitlab/gitlab-production-main/sessions/30273/commands/93920
Click to expand query
SELECT
"compliance_management_frameworks"."name"
FROM
"compliance_management_frameworks"
INNER JOIN "project_compliance_framework_settings" ON "compliance_management_frameworks"."id" = "project_compliance_framework_settings"."framework_id"
WHERE
"project_compliance_framework_settings"."project_id" = 58283029;
Screenshots or screen recordings
Before
"compliance_frameworks": [
"framework2"
]
After
"compliance_frameworks": [
"framework2",
"framework3"
]
How to set up and validate locally
- For this you need to have a group with Ultimate license.
- Have atleast one project under the group.
- Create atleast 2 compliance frameworks for the group by following steps mentioned in https://docs.gitlab.com/ee/user/compliance/compliance_center/compliance_frameworks_report.html#create-a-new-compliance-framework.
- Add more than 1 compliance framework for the project by visiting the compliance center of the group(Left sidebar -> Secure -> Compliance center) and apply frameworks to project how it is shown in https://gitlab.com/-/project/278964/uploads/56ba1d15e45f8509373c02df91d20c53/2024-07-19_16.49.14.gif.
- Now, create access token for the user and then run the following command to check that all the frameworks are included in project api response.
curl --location 'http://gitlab.localdev:3000/api/v4/projects/17702' --header 'PRIVATE-TOKEN: <token>' - Check for
compliance_frameworksin the response and it should be an array with list of all the frameworks associated with the project.
Related to #464161 (closed)
Edited by Hitesh Raghuvanshi