MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / onDownloadBizUsers

Method onDownloadBizUsers

src/database/WizDatabase.cpp:1363–1417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1361}
1362
1363bool WizDatabase::onDownloadBizUsers(const QString& kbGuid, const CWizBizUserDataArray& arrayUser)
1364{
1365 if (arrayUser.empty())
1366 return false;
1367 //
1368
1369 CWizBizUserDataArray oldUsers;
1370 if (users(kbGuid, oldUsers))
1371 {
1372 std::map<QString, WIZBIZUSER> old;
1373 for (const auto& user: oldUsers)
1374 {
1375 old[user.userGUID] = user;
1376 }
1377 //
1378 bool bHasError = false;
1379 CWizBizUserDataArray::const_iterator it;
1380 for (it = arrayUser.begin(); it != arrayUser.end(); it++)
1381 {
1382 const WIZBIZUSER& user = *it;
1383 const WIZBIZUSER oldUser = old[user.userGUID];
1384 //
1385 if (oldUser == user)
1386 continue;
1387 //
1388 if (oldUser.userGUID.isEmpty())
1389 {
1390 if (createUserEx(user)) {
1391 bHasError = true;
1392 }
1393 }
1394 else
1395 {
1396 if (modifyUserEx(user)) {
1397 bHasError = true;
1398 }
1399 }
1400 }
1401 return !bHasError;
1402 }
1403 else
1404 {
1405 bool bHasError = false;
1406 CWizBizUserDataArray::const_iterator it;
1407 for (it = arrayUser.begin(); it != arrayUser.end(); it++)
1408 {
1409 const WIZBIZUSER& user = *it;
1410 if (!updateBizUser(user)) {
1411 bHasError = true;
1412 }
1413 }
1414
1415 return !bHasError;
1416 }
1417}
1418
1419
1420IWizSyncableDatabase* WizDatabase::getGroupDatabase(const WIZGROUPDATA& group)

Callers 1

syncGroupUsersFunction · 0.80

Calls 4

beginMethod · 0.80
endMethod · 0.80
isEmptyMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected