[
https://issues.apache.org/jira/browse/OAK-2991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14591563#comment-14591563
]
angela edited comment on OAK-2991 at 6/18/15 10:03 AM:
-------------------------------------------------------
thanks for reporting... i will look into it asap.
btw: you have to use {{user.declaredMemberOf()}}, otherwise you will also get
the inherited group where you obviously can't remove this very member.
was (Author: anchela):
thanks for reporting... i will look into it asap.
> 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: core
> Affects Versions: 1.2.2
> Reporter: Alexander Klimetschek
> Assignee: angela
> Priority: Minor
>
> 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)