Skip to content

Add doc and test for set group avatar REST API

What does this MR do?

Allows a file to be submitted as avatar on API Update Group PUT groups/:id for Admin (It was already working during Create Group POST groups)

  • Most of the code and tests were already there from the Create Group shared_examples, and the API doc already lists this param for updating group (PUT) as well as create (POST).

Updates Groups API doc under "Update group"

doc

Closes #22453 (closed)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "http://localhost:3000/api/v4/groups/67" --form "avatar=@/tmp/example.jpg"

Response:

{"id":67,"web_url":"http://127.0.0.1:3000/groups/h5bp/subgrphb5","name":"subgrphb5","path":"subgrphb5","description":"","visibility":"private","share_with_group_lock":false,"require_two_factor_authentication":false,"two_factor_grace_period":48,"project_creation_level":"developer","auto_devops_enabled":null,"subgroup_creation_level":"maintainer","emails_disabled":null,"mentions_disabled":null,"lfs_enabled":true,"default_branch_protection":2,"avatar_url":"http://127.0.0.1:3000/uploads/-/system/group/avatar/67/example.jpg","request_access_enabled":true,"full_name":"H5bp / subgrphb5","full_path":"h5bp/subgrphb5","created_at":"2020-12-29T16:42:24.321Z","parent_id":28,"ldap_cn":null,"ldap_access":null,"marked_for_deletion_on":null,"shared_with_groups":[],"projects":[],"shared_projects":[],"shared_runners_minutes_limit":null,"extra_shared_runners_minutes_limit":null,"prevent_forking_outside_group":false}

after

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #22453 (closed)

Edited by Jackie Fraser

Merge request reports