Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-61250

When a user group is deleted, the creator of that user group looses all user group memberships

Details

    Description

      Description
      When a user group is deleted, the user-userGroup mapping for the creator (owner) of the user group is lost.

      Reproduction
      1. Log in with test user
      2. Create 2 another admin users: user1, user2 (currently I cannot add test admin to any user groups)
      3. Log in with user1
      4. Create 2 user groups, usergroup1, usergroup2
      5. Add user1 and user2 users to usergroup1.
      6. Delete usergroup2
      7. Check usergroup1's memberships

      Result: user1 is dropped out.
      Expected Result: user1 is still a member of usergroup1

      History
      1. UserGroupLocalService.clearUserUserGroups(long userId) was originally created for LEP-3236. When importing from LDAP the way to update users and user groups associations was to delete all of these then reimport.

      2. LEP-5327 Handled user group deletion. This tried to use clearUserUserGroups() in the case when inactive users were associated with the user group. After the confirmation these associations were deleted.

      Here at commit: 1dcafcf080e41f659ba3d3bd746a641966176c95 clearUserUserGroups(userGroupId); was added which called this method with userGroupId instead of userId.

      (I think that the intention here was to check if active users are associated with the group, then if not, then clean up the inactive users.)

      At this time: only the _importGroupsAndMembershipFromLDAPUser was calling this method.

      So probably nothing ever happened because there was no user with the groupId until...

      3. LPS-54887 with the commit: https://github.com/brianchandotcom/liferay-portal/commit/82e6a129eb264fe66469e4496e7e537d617dd0db

      This modification revealed the bug.

      Solution
      This part should be removed because when you delete a user group, then UserGroupPersistenceImpl handles and deletes the association between the user group (to be deleted) and all (possible inactive) users attached to it.

      Note: You cannot delete a user group if there are active users associated with it.

      Attachments

        1. Fixed.PNG
          Fixed.PNG
          28 kB
        2. Reproduced.PNG
          Reproduced.PNG
          33 kB

        Issue Links

          Activity

            People

              harry.chai Harry Chai
              adam.nagy Ádám T. Nagy (Inactive)
              Rafaela Nascimento Rafaela Nascimento
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                7 years, 25 weeks, 6 days ago

                Packages

                  Version Package
                  6.2.X EE
                  7.0.0 Beta 1