DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40720>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40720

           Summary: Adding groups to a user throws an error
           Product: Tomcat 5
           Version: 5.5.17
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Webapps:Administration
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


Error is caused by the fact that somehow the group looked for is surrouded by 
"" so looking for group1 
"group1" is searched for.

Simpel solution I added in org.apache.catalina.mbeans.UserMBean is the removal 
of " from the 
groupname when searching for it.

    public void addGroup(String groupname) {

        User user = (User) this.resource;
        if (user == null) {
            return;
        }
        String lookupGroupname = groupname.replaceAll("\"", "");
        Group group = user.getUserDatabase().findGroup(lookupGroupname);
        if (group == null) {
            throw new IllegalArgumentException
                ("Invalid group name '" + lookupGroupname + "'");
        }
        user.addGroup(group);

    }

the only change I made is the adding of replaceAll 

Sorry for not making a proper patch file but I don't know how to do it. Hope 
you can implement this 
solution so adding of groups to a user works.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to