Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-67300

Cannot remove user(s) from certain group(s) if some groups have mixed cases in the database

XMLWordPrintable

      Summary

      If a group is available in both the JIRA internal directory and an external directory and was created in each directory with mixed cases, the following error will be shown in the UI when trying to remove a user from this group:

      Cannot remove user 'admin' from group 'jira-users-test' since user is not a member of 'jira-users-test'
      

      Steps to reproduce

      1. Log in JIRA as a system admin user
      2. Create a group called JIRA-users-test in the JIRA internal directory (from ⚙ > User Management > Groups)
      3. Create a user called admin in the JIRA internal directory (from ⚙ > User Management > Users)
      4. Add the admin user to the JIRA-users-test group (from ⚙ > User Management > Users)
      5. Create an Apache LDAP directory add to this directory a user called john and a group called jira-users-test (make sure that the name of the group is in all lower case)
      6. Add the user john to the jira-users-test group within the LDAP
      7. Connect JIRA to this LDAP directory with read/write permission and sync with the directory (from ⚙ > User Management > Directories)
      8. Go to the page ⚙ > User Management > Users and look for the 2 users admin and john. Note that the 2 groups JIRA-users-test and jira-users-test these users belong to are displayed with different cases:
      9. Go to ⚙ > User Management > Groups and note that there is only 1 version of the jira-users-test group, which is jira-users-test (the lower-cased version of the 2 groups):
      10. Click on "Edit Member" next to the jira-users-test group, and try to remove the user 'admin'
      11. Go back to ⚙ > User Management > Users, look for the user admin, and try to remove the JIRA-users-test group from this user

      Expected Results

      • In Step 9, the admin user should be removed from the group jira-users-test
      • In Step 10, the group JIRA-users-test should be removed from the user admin

      Actual Results

      • In step 9, we get the following error:
        Cannot remove user 'admin' from group 'jira-users-test' since user is not a member of 'jira-users-test'
        

      • In step 10, we get the following error:
        You can not remove a group from this user as it is not visible to you
        

      Note that on the other hand, JIRA allows me to remove the user *john from the group 'jira-users-test'*

      Troubleshooting

      To confirm that you are indeed facing this bug, you can look into the cwd_group and cwd_membership tables in the database and verify that you can see the mixed case versions of the group jira-users-test in these tables:

      It seems that JIRA treats somehow the 2 versions of the groups as 2 different groups (instead of the same group), and does not map properly users to the right group, and cause the error when we try to remove a user from this group.

      Workaround

      Please make sure to create a native backup of your JIRA database before running the following query, to that you can revert the changes if anything goes wrong.
      Running the following query will be at your own risk.

      • Stop JIRA
      • Backup your database
      • Run the following queries to force the group_name column from the cwd_group table and the parent_name column from the cwd_membership table to be all lower cased (note that the query to run might slightly different depending on the type of database that you are using)
        update cwd_group set group_name = LOWER(group_name);
        update cwd_membership set parent_name = LOWER(parent_name);
        
      • Start JIRA

        1. Local_UsersWithSameGroup.png
          Local_UsersWithSameGroup.png
          138 kB
        2. Local_Only1Group.png
          Local_Only1Group.png
          421 kB
        3. Local_Membership_DB.png
          Local_Membership_DB.png
          70 kB
        4. Local_Group_DB.png
          Local_Group_DB.png
          59 kB
        5. Local_CantRemoveUserFromGroup.png
          Local_CantRemoveUserFromGroup.png
          161 kB
        6. Local_CantRemoveGroupFromUser.png
          Local_CantRemoveGroupFromUser.png
          232 kB

              Unassigned Unassigned
              jrey Julien Rey
              Votes:
              5 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated: