1
0
mirror of https://github.com/altlinux/admc.git synced 2025-01-22 18:03:57 +03:00

Add connected DC's OS and its version to domain info results

This commit is contained in:
Semyon Knyazev 2024-02-19 05:46:18 +04:00
parent 21332966b6
commit 701f68b714
3 changed files with 74 additions and 49 deletions

View File

@ -87,7 +87,8 @@ void DomainInfoResultsWidget::update_defaults() {
ui->dc_count_value,
ui->domain_functionality_value,
ui->forest_functionality_value,
ui->domain_schema_value
ui->domain_schema_value,
ui->dc_version_value
};
for (auto label : labels) {
set_label_failed(label, false);
@ -132,11 +133,19 @@ DomainInfo_SearchResults DomainInfoResultsWidget::search_results() {
const QStringList root_dse_attributes = {
ATTRIBUTE_DOMAIN_FUNCTIONALITY_LEVEL,
ATTRIBUTE_FOREST_FUNCTIONALITY_LEVEL,
ATTRIBUTE_SCHEMA_NAMING_CONTEXT
ATTRIBUTE_SCHEMA_NAMING_CONTEXT,
ATTRIBUTE_DNS_HOST_NAME,
ATTRIBUTE_SERVER_NAME
};
const AdObject rootDSE = ad.search_object("", root_dse_attributes);
const QString server_name = rootDSE.get_string(ATTRIBUTE_SERVER_NAME);
const AdObject server_object = ad.search_object(server_name, {ATTRIBUTE_SERVER_REFERENCE});
const AdObject host = ad.search_object(server_object.get_string(ATTRIBUTE_SERVER_REFERENCE), {ATTRIBUTE_OS, ATTRIBUTE_OS_VERSION});
const QString dc_version = host.get_string(ATTRIBUTE_OS) + QString(" (%1)").arg(host.get_string(ATTRIBUTE_OS_VERSION));
results.domain_controller_version = dc_version;
const int forest_level = rootDSE.get_int(ATTRIBUTE_FOREST_FUNCTIONALITY_LEVEL);
const QString forest_level_string = QString::number(forest_level) + " " + functionality_level_to_string(forest_level);
results.forest_functional_level = forest_level_string;
@ -182,7 +191,8 @@ void DomainInfoResultsWidget::populate_widgets(DomainInfo_SearchResults results)
const QHash<QLabel*, QString> label_results_hash {
{ui->domain_functionality_value, results.domain_functional_level},
{ui->forest_functionality_value, results.forest_functional_level},
{ui->domain_schema_value, results.domain_schema_version}
{ui->domain_schema_value, results.domain_schema_version},
{ui->dc_version_value, results.domain_controller_version}
};
for (QLabel *label : label_results_hash.keys()) {
if (label_results_hash[label].isEmpty()) {

View File

@ -41,6 +41,7 @@ struct DomainInfo_SearchResults {
QString domain_functional_level;
QString forest_functional_level;
QString domain_schema_version;
QString domain_controller_version;
};
class DomainInfoResultsWidget : public QWidget

View File

@ -61,35 +61,7 @@
<property name="verticalSpacing">
<number>10</number>
</property>
<item row="2" column="0">
<widget class="QLabel" name="domain_schema_version_label">
<property name="text">
<string>Domain schema version:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="domain_schema_value">
<property name="text">
<string>PLACEHOLDER</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="forest_functionality_label">
<property name="text">
<string>Forest functionality level:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="dc_count_value">
<property name="text">
<string>PLACEHOLDER</string>
</property>
</widget>
</item>
<item row="2" column="2">
<item row="3" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -102,14 +74,56 @@
</property>
</spacer>
</item>
<item row="5" column="1">
<item row="6" column="0">
<widget class="QLabel" name="forest_functionality_label">
<property name="text">
<string>Forest functionality level:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="domain_schema_version_label">
<property name="text">
<string>Domain schema version:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="domain_schema_value">
<property name="text">
<string>PLACEHOLDER</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="dc_count_label">
<property name="text">
<string>Domain controllers count:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="domain_functionality_label">
<property name="text">
<string>Domain functionality level:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="sites_count_value">
<property name="text">
<string>PLACEHOLDER</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="forest_functionality_value">
<property name="text">
<string>PLACEHOLDER</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QLabel" name="domain_functionality_value">
<property name="text">
<string>PLACEHOLDER</string>
@ -117,28 +131,28 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="dc_count_label">
<property name="text">
<string>Domain controllers count:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="domain_functionality_label">
<property name="text">
<string>Domain functionality level:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="sites_count_label">
<property name="text">
<string>Sites count:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="dc_count_value">
<property name="text">
<string>PLACEHOLDER</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="dc_version_label">
<property name="text">
<string>Domain controller version:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="sites_count_value">
<widget class="QLabel" name="dc_version_value">
<property name="text">
<string>PLACEHOLDER</string>
</property>