Item12067: Removing members via WikiGroups not possible when login name different from WikiName
Priority: Normal
Current State: Closed
Released In: 2.1.0
Target Release: minor
The
GroupViewTemplate has stuff to remove users from groups right on the WikiGroups page or the individual group pages. This works great if the user you want to remove uses their WikiName as the login name, but otherwise it breaks. This is because the function uses, via a few indirections,
TopicUserMapping::removeUserFromGroup
, and that function does an
isInGroup
check which will only pass if it receives a cUID.
The fix seems pretty simple. In fact, there are two ways to do it. One is to change the
isInGroup
call so that it accepts WikiNames, too (probably just set the expand param to 1?). The other is to change the form from which the whole request originates:
diff --git a/data/Main/GroupViewTemplate.txt b/data/Main/GroupViewTemplate.txt
index 25044b5..d0bda54 100644
--- a/data/Main/GroupViewTemplate.txt
+++ b/data/Main/GroupViewTemplate.txt
@@ -231,7 +231,7 @@ then='
<div class=\"foswikiFormStep\">
<h3>%MAKETEXT{"Select members to remove from this group"}%:</h3>"
format="<label style=\"display:block\">
- <input type=\"checkbox\" name=\"username\" value=\"$wikiname\" /> <nop>$wikiname
+ <input type=\"checkbox\" name=\"username\" value=\"$username\" /> <nop>$wikiname
</label>"
footer="</div>
<a class=\"jqUIDialogButton jqUIDialogSubmit jqUIDialogClose {icon:'ui-icon-circle-check'}\" >%MAKETEXT{"Remove selected members"}%</a>
--
JanKrueger - 05 Sep 2012
The proposed fix doesn't work for default
TopicUserMapping. You get an error - username not provided. The issue is probably deeper in the API.
The isInGroup can't be changed either. You don't want to expand the group membership when maintaining groups. The changes need to act solely on the group and not on nested groups. The expand option controls the expansion of nested groups when doing ACL validation.
--
GeorgeClark - 21 Dec 2014
I think I accidentally fixed this for
TopicUserMapping, in commit
distro:c8cb7ef1e48d. Patch causes Foswiki to substitute the
WikiName for the
UserName if username is not defined. With that patch, the above patch appears to work fine for TopicUserMapping. But I don't want to change it on the eve of the next release. Marking this for 2.1
--
GeorgeClark - 13 Nov 2015
Jan, I've checked this fix into 2.1. Please verify it with your mappers. Thanks.
--
GeorgeClark - 19 Dec 2015