/** * Set a user to group * * @param string $GrpUid, $UsrUid * @return array */ function addUserToGroup($GrpUid, $UsrUid) { try { $oGrp = GroupUserPeer::retrieveByPk($GrpUid, $UsrUid); if (is_object($oGrp) && get_class($oGrp) == 'GroupUser') { return true; } else { $oGrp = new GroupUser(); $oGrp->setGrpUid($GrpUid); $oGrp->setUsrUid($UsrUid); $oGrp->Save(); } } catch (exception $oError) { throw $oError; } }
/** * Set a user to group * * @param string $GrpUid, $UsrUid * @return array */ public function addUserToGroup($GrpUid, $UsrUid) { try { $oGrp = GroupUserPeer::retrieveByPk($GrpUid, $UsrUid); if (is_object($oGrp) && get_class($oGrp) == 'GroupUser') { return true; } else { $oGrp = new GroupUser(); $oGrp->setGrpUid($GrpUid); $oGrp->setUsrUid($UsrUid); $oGrp->Save(); $oGrpwf = new Groupwf(); $grpName = $oGrpwf->loadByGroupUid($GrpUid); $oUsr = new Users(); $usrName = $oUsr->load($UsrUid); G::auditLog("AssignUserToGroup", "Assign user " . $usrName['USR_USERNAME'] . " (" . $UsrUid . ") to group " . $grpName['CON_VALUE'] . " (" . $GrpUid . ") "); } } catch (exception $oError) { throw $oError; } }