Bug: fix group access level
What does this MR do and why?
Hello,
It's actually not possible to share a project with a group. The access level check if user can be read the namespace, but we check a group.
I'm not sure about my fix but that work correctly on my dev instance.
I suppose that can fix #343617
Screenshots or screen recordings
╰─➤ curl --request POST --header "PRIVATE-TOKEN: thisIsMyToken" https://mygitlab.test/api/v4/projects/2/share -H 'Content-Type: application/json' -d '{"group_access": 30, "group_id": 4}' -i
HTTP/2 404
server: nginx
date: Mon, 05 Sep 2022 13:21:23 GMT
content-type: application/json
content-length: 23
cache-control: no-cache
vary: Origin
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-request-id: 01GC6X03YKJXZ2115H1F5S5J5Y
x-runtime: 1.000036
{"message":"Not Found"}
How to set up and validate locally
curl --request POST --header "PRIVATE-TOKEN: thisIsMyToken" https://mygitlab.test/api/v4/projects/2/share -H 'Content-Type: application/json' -d '{"group_access": 30, "group_id": 4}' -i
HTTP/2 201
server: nginx
date: Mon, 05 Sep 2022 13:25:10 GMT
content-type: application/json
content-length: 72
cache-control: max-age=0, private, must-revalidate
etag: W/"88a1d83c6182bbea6cc3358e38808109"
vary: Origin
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-request-id: 01GC6X70WNRJD73PP1SYC41XTM
x-runtime: 1.083237
strict-transport-security: max-age=63072000
referrer-policy: strict-origin-when-cross-origin
{"id":1,"project_id":2,"group_id":4,"group_access":30,"expires_at":null}
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.