Add gPAT support for semantic code search REST API endpoint

Summary

  • Adds route_setting :authorization, permissions: :read_code, boundary_type: :project to the semantic code search REST endpoint
  • Creates config/authz/permissions/code/read.yml permission definition file
  • Creates config/authz/permission_groups/assignable_permissions/repository/code/read.yml assignable permission YAML
  • Removes read_code from definitions_todo.txt and removes the route from authorization_todo.txt
  • Regenerates gPAT allowed endpoints documentation
  • Adds it_behaves_like 'authorizing granular token permissions', :read_code spec coverage

Closes https://gitlab.com/gitlab-org/gitlab/-/work_items/595033

How to test

Unit tests:

bundle exec rspec ee/spec/requests/ee/api/search/semantic_code_search_spec.rb

Permissions validation:

bundle exec rake gitlab:permissions:validate

Merge request reports

Loading