if (!($password_hash = updateUserPassword($user_id, $password, $passwordc))) { $error_count++; } else { // If we're updating for the currently logged in user, update their hash_pw field if ($self) { $loggedInUser->hash_pw = $password_hash; } $success_count++; } } //Remove groups if (!empty($rm_groups)) { // Convert string of comma-separated group_id's into array $group_ids_arr = explode(',', $rm_groups); foreach ($group_ids_arr as $group_id) { if (removeUserFromGroup($user_id, $group_id)) { $success_count++; } else { $error_count++; } } } // Add groups if (!empty($add_groups)) { // Convert string of comma-separated group_id's into array $group_ids_arr = explode(',', $add_groups); foreach ($group_ids_arr as $group_id) { if (addUserToGroup($user_id, $group_id)) { $success_count++; } else { $error_count++;
/* verify that user is admin */ checkAdmin(); /* parse result */ foreach ($_POST as $k => $p) { if (substr($k, 0, 4) == "user") { $users[substr($k, 4)] = substr($k, 4); } } /* verify that description is present if action != delete */ if (strlen($_POST['gid'] == 0)) { die("<div class='alert alert-error'>" . _('Error - no group ID') . "</div>"); } /* remove each user from group */ if (sizeof($users) > 0) { foreach ($users as $key => $u) { if (!removeUserFromGroup($_POST['gid'], $u)) { # get user details $user = getUserDetailsById($u); $errors[] = $user['real_name']; } } } else { $errors[] = _("Please select user(s) to remove from group!"); } /* print result */ if (isset($errors)) { print "<div class='alert alert-error'>"; print _("Failed to remove users") . ":<hr>"; print "<ul>"; foreach ($errors as $e) { print "<li>{$e}</li>";
$response = getUserList($json["userId"], $json["raw"], false); } else { if ($request == "getAllAccountReady") { $response = getUserList($json["userId"], $json["raw"], true); } else { if ($request == "save") { $response = saveUser($json["data"]); } else { if ($request == "createUser") { $response = createUser($json["raw"]); } else { if ($request == "saveGroups") { $response = saveGroups($json["data"]); } else { if ($request == "removeUserFromGroup") { $response = removeUserFromGroup($json["data"]); } else { if ($request == "addUserToGroup") { $response = addUserToGroup($json["data"]); } else { if ($request == "getUsersUngroup") { $response = getUsersUngroup($json["data"]); } else { if ($request == "removeGroup") { $response = removeGroup($json["data"]); } else { if ($request == "createGroup") { $response = createGroup($json["data"]); } else { $response = getJSONFromCodeError(202); }
$RequestError = true; } // shows notification if ($RequestError) { $notifications[] = MakeNotification("error", Language::Get('main', 'errorLeaveGroup', $langTemplate)); } else { $notifications[] = MakeNotification("success", Language::Get('main', 'successLeaveGroup', $langTemplate)); } } else { $notifications[] = MakeNotification("error", Language::Get('main', 'errorLeaveGroup', $langTemplate)); } } else { // bool which is true if any error occured $RequestError = false; // removes the user from the group if (removeUserFromGroup($uid, $sid)) { if (!removeSelectedSubmission($uid, $sid)) { $RequestError = true; } } else { $RequestError = true; ///$notifications[] = MakeNotification("error", "Fehler else."); } // shows notification if ($RequestError) { $notifications[] = MakeNotification("error", Language::Get('main', 'errorLeaveGroup', $langTemplate)); } else { $notifications[] = MakeNotification("success", Language::Get('main', 'successLeaveGroup', $langTemplate)); } } }