本文整理汇总了C++中MongoDatabase::loadUsers方法的典型用法代码示例。如果您正苦于以下问题:C++ MongoDatabase::loadUsers方法的具体用法?C++ MongoDatabase::loadUsers怎么用?C++ MongoDatabase::loadUsers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoDatabase
的用法示例。
在下文中一共展示了MongoDatabase::loadUsers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ui_editUser
void ExplorerTreeWidget::ui_editUser()
{
ExplorerUserTreeItem *userItem = selectedUserItem();
if (!userItem)
return;
MongoUser user = userItem->user();
MongoDatabase *database = userItem->database();
MongoServer *server = database->server();
CreateUserDialog dlg(server->connectionRecord()->getFullAddress(),
database->name(),
user);
dlg.setWindowTitle("Edit User");
dlg.setUserPasswordLabelText("New Password:");
int result = dlg.exec();
if (result == QDialog::Accepted) {
MongoUser user = dlg.user();
database->createUser(user, true);
// refresh list of users
database->loadUsers();
}
}
示例2: ui_dropUser
void ExplorerTreeWidget::ui_dropUser()
{
ExplorerUserTreeItem *userItem = selectedUserItem();
if (!userItem)
return;
MongoUser user = userItem->user();
MongoDatabase *database = userItem->database();
MongoServer *server = database->server();
// Ask user
int answer = QMessageBox::question(this,
"Remove User",
QString("Remove <b>%1</b> user?").arg(user.name()),
QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton);
if (answer != QMessageBox::Yes)
return;
database->dropUser(user.id());
database->loadUsers(); // refresh list of users
}