You are here: Foswiki>Tasks Web>Item12067 (03 Feb 2016, GeorgeClark)Edit Attach

Item12067: Removing members via WikiGroups not possible when login name different from WikiName

pencil
Priority: Normal
Current State: Closed
Released In: 2.1.0
Target Release: minor
Applies To: Extension
Component: TopicUserMappingContrib
Branches: master Item13897
Reported By: JanKrueger
Waiting For:
Last Change By: GeorgeClark
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
 

ItemTemplate edit

Summary Removing members via WikiGroups not possible when login name different from WikiName
ReportedBy JanKrueger
Codebase 1.1.5, trunk
SVN Range
AppliesTo Extension
Component TopicUserMappingContrib
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:25c3275099f4
TargetRelease minor
ReleasedIn 2.1.0
CheckinsOnBranches master Item13897
trunkCheckins
masterCheckins distro:25c3275099f4
ItemBranchCheckins distro:25c3275099f4
Release02x00Checkins
Release01x01Checkins
Topic revision: r7 - 03 Feb 2016, GeorgeClark - This page was cached on 22 Sep 2017 - 05:55.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License