Skip to content

Return Additional Error Messages When Minimal Access Role is Not Available

Mark Smith requested to merge (removed):issue-331012 into master

Solves Issue #331012 (closed)

Return Additional Minimal Access Role Not Available Error Messages

The message, access_level is not included in the list, returned when an API call attempts to assign minimal access to a user does not tell what the issue is. The message should tell the caller why it failed. The current message might cause the caller to open a support ticket or create a defect issue.

Current production code curl command and output below.

# request to add a new group member
curl --request POST --header "PRIVATE-TOKEN: $GL_TOKEN" "https://gitlab.com/api/v4/groups/GROUP_ID/members?user_id= MEMBER_ID&access_level=5"
{"message":{"access_level":["is not included in the list"]}}%

# request to edit an existing group member
curl --request PUT --header "PRIVATE-TOKEN: $GL_TOKEN" "https://gitlab.com/api/v4/groups/GROUP_ID/members/MEMBER_ID?access_level=5"
{"message":{"access_level":["is not included in the list"]}}%

The changed code adds the errors below to the existing "is not included in the list" message:

  • minimal access supported on top level group only
  • minimal access not supported by all license types

Changed code curl command and output below.

# request to add a new group member
curl --request POST --header "PRIVATE-TOKEN: $GL_TOKEN" "https://3000-amaranth-rabbit-1vxc00oy.ws-us04.gitpod.io/api/v4/groups/GROUP_ID/members?user_id=USER_ID&access_level=5"
{"message":{"access_level":["is not included in the list","minimal access supported on top level group only","minimal access not supported by all license types"]}}%

# request to edit an existing group member
curl --request PUT --header "PRIVATE-TOKEN: $GL_TOKEN" "https://3000-amaranth-rabbit-1vxc00oy.ws-us04.gitpod.io/api/v4/groups/108/members/99?access_level=5"
{"message":{"access_level":["is not included in the list","minimal access supported on top level group only","minimal access not supported by all license types"]}}%

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Browser testing is not needed this is an API call error message change. I am not aware of quality/performance impacts. An expectation in one spec file has been updated.

Edited by Abdul Wadood

Merge request reports