Skip to content

Customizable roles cannot be edited when assigned

Smriti Garg requested to merge smriti-375661/custom_roles_cannot_be_edited into master

What does this MR do and why?

Solves #375661 (closed)

Screenshots or screen recordings

Relevant specs have been added to test the change.

Screenshot from rails console Screenshot_2022-12-07_at_4.30.54_PM

How to set up and validate locally

  1. Create a new member_role for a root level group

    curl --request POST --header "Content-Type: application/json" --header "Authorization: Bearer $YOUR_ACCESS_TOKEN" --data '{"base_access_level":10, "download_code":1}' "https://gdk.test:3443/api/v4/groups/$GROUP_PATH/member_roles"

  2. In rails console assign any member newly created member_role

     group = Group.find_by(path: '$GROUP_PATH')
     user = User.find_by(email: '$TEST_USER_EMAIL')
     member_role = group.member_roles.first
     member = Member.where(user: user, source: group).first
     member.update!(member_role: member_role)
  3. Try and update any attribute for new member_role and an exception should be raised

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Smriti Garg

Merge request reports