You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Alexander Klimetschek (JIRA)" <ji...@apache.org> on 2015/06/15 12:14:00 UTC

[jira] [Created] (OAK-2991) group.removeMember() on result of user.memberOf() does not work

Alexander Klimetschek created OAK-2991:
------------------------------------------

             Summary: group.removeMember() on result of user.memberOf() does not work
                 Key: OAK-2991
                 URL: https://issues.apache.org/jira/browse/OAK-2991
             Project: Jackrabbit Oak
          Issue Type: Bug
          Components: security
    Affects Versions: 1.2.2
            Reporter: Alexander Klimetschek


When using the group from the memberOf() iterator to remove a user from that group, the change is not persisted. One has to fetch the group separately from the UserManager.

{code}
final Iterator<Group> groups = user.memberOf();
while (groups.hasNext()) {
    Group group = groups.next();
    group.removeMember(user); // does not work
    session.save();
    
    group = userManager.getGroup(group.getID());
    group.removeMember(user); // does work
    session.save(); 
}
{code}

Note that {{removeMember()}} always returns true, indicating that the change worked. Debugging through the code, especially MembershipWriter, shows that the rep:members property is correctly updated, so probably some later modification restores the original value before the save is executed. (No JCR events are triggered for the group).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)