/** * updateUser - update a user's permissions. * * @param int user_id of the user to update. * @param int (1) tech only, (2) admin & tech (3) admin only. * @return boolean success. */ function updateUser($id, $perm_level) { if (!$this->userIsAdmin()) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_canned', 'perm_denied')); return false; } if (!$id) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_canned', 'missing_param')); return false; } $perm_dao = new Tracker_PermDao(); $row = $perm_dao->searchByUserIdAndTrackerId($id, $this->getId())->getRow(); if ($row) { if ($perm_dao->updateUser($id, $perm_level, $this->getId())) { return true; } else { return false; } } else { if ($perm_dao->createUser($id, $perm_level, $this->getId())) { return true; } else { return false; } } }