Add code completions enabled API
requested to merge 430919-technical-breakdown-how-to-block-projects-from-requesting-code-suggestions-2 into master
What does this MR do and why?
Adds new enabled
endpoint to the code completions API and a new project setting code_suggestions
. enabled
will return 403 Forbidden
if a project has code_suggestions
disabled or it's group has code_suggestions
disabled in it's namespace settings.
Adds ability to read and update code_suggestions
on the project to update the new project settings field
Screenshots or screen recordings
POST /api/v4/code_suggestions/enabled
{ "project_path": "group/project_name" }
Output
Either 200
if enabled or 403
if not enabled.
How to set up and validate locally
- Disable code suggestions for a project (
project.project_setting.update!(code_suggestions: false)
in rails console) - Alternately, you can disable code suggestions for a project's parent group (Group >> Settings >> General >> Permissions)
- Make a request to the code completion
enabled
API with the project's full_path - Note the
403
response
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #430919 (closed)
Edited by Allen Cook