Commit 919d4475aa62cea12f53cad4711ed72f6621d7e6

Authored by nbm
1 parent 8e10e5a7

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 125 if($oUser->create()) {
126 126 // now add the user to the initial group
127 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 138 $oPatternCustom->setHtml(getPageGroupFail());
135   - }
  139 + }
136 140 } else {
137 141 $oPatternCustom->setHtml(getPageFail());
138 142 }
... ...