Commit f1da74f12b602e6088acd6382c28651988268c29

Authored by Neil Blakey-Milner
1 parent 27e32678

Use Group->addMember instead of creating GroupUserLink object.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3421 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/administration/usermanagement/addUserBL.php
@@ -125,14 +125,18 @@ if (checkSession()) { @@ -125,14 +125,18 @@ if (checkSession()) {
125 if($oUser->create()) { 125 if($oUser->create()) {
126 // now add the user to the initial group 126 // now add the user to the initial group
127 $default->log->info("adding user id " . $oUser->getID() . " to group id $fGroupID"); 127 $default->log->info("adding user id " . $oUser->getID() . " to group id $fGroupID");
128 - $oUserGroup = new GroupUserLink($fGroupID,$oUser->getID());  
129 - if ($oUserGroup->create()) {  
130 - // FIXME: update search permissions for the group  
131 - // redirect to list page  
132 - controllerRedirect("listUsers");  
133 - } else { 128 + $oGroup = Group::get($fGroupID);
  129 + if (!PEAR::isError($oGroup)) {
  130 + if ($oGroup->addMember($oUser)) {
  131 + // FIXME: update search permissions for the group
  132 + // redirect to list page
  133 + exit(controllerRedirect("listUsers"));
  134 + } else {
  135 + $oPatternCustom->setHtml(getPageGroupFail());
  136 + }
  137 + } else {
134 $oPatternCustom->setHtml(getPageGroupFail()); 138 $oPatternCustom->setHtml(getPageGroupFail());
135 - } 139 + }
136 } else { 140 } else {
137 $oPatternCustom->setHtml(getPageFail()); 141 $oPatternCustom->setHtml(getPageFail());
138 } 142 }