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

Small refactor and domain policy link icon bugfix

Fixed ou policy index search function name.
Domain policy link icon bug is also fixed (#49385).
This commit is contained in:
Semyon Knyazev 2024-02-13 21:53:49 +04:00
parent fd65784f34
commit c033dd874f
4 changed files with 8 additions and 7 deletions

View File

@ -233,7 +233,7 @@ void PolicyImpl::on_edit() {
void PolicyImpl::update_policy_item_icons(const QString &policy_dn, const QString &ou_dn, bool is_checked, GplinkOption option) {
//Group Policy Objects item index
QModelIndex ou_dn_item_index = search_gpo_ou_index(console, ou_dn);
QModelIndex target_policy_index = get_ou_child_policy_item(console, ou_dn_item_index, policy_dn);
QModelIndex target_policy_index = get_ou_child_policy_index(console, ou_dn_item_index, policy_dn);
if (!target_policy_index.isValid())
return;

View File

@ -524,7 +524,7 @@ void policy_ou_impl_load_item_data(QStandardItem *item, const AdObject &object)
item->setData(inheritance_is_blocked, PolicyOURole_Inheritance_Block);
}
QModelIndex get_ou_child_policy_item(ConsoleWidget *console, const QModelIndex &ou_index, const QString &policy_dn) {
QModelIndex get_ou_child_policy_index(ConsoleWidget *console, const QModelIndex &ou_index, const QString &policy_dn) {
QList<QModelIndex> found_policy_indexes = console->search_items(ou_index,
PolicyRole_DN,
policy_dn,
@ -532,10 +532,11 @@ QModelIndex get_ou_child_policy_item(ConsoleWidget *console, const QModelIndex &
QModelIndex policy_index = QModelIndex();
for (QModelIndex index : found_policy_indexes)
{
if (index.parent().data(ConsoleRole_Type) == ItemType_PolicyOU)
if (index.parent().data(ConsoleRole_Type) == ItemType_PolicyOU &&
index.parent().data(PolicyOURole_DN) == ou_index.data(PolicyOURole_DN))
{
policy_index = index;
break;
return policy_index;
}
}

View File

@ -94,10 +94,10 @@ void policy_ou_impl_add_objects_from_dns(ConsoleWidget *console, AdInterface &ad
void policy_ou_impl_add_objects_to_console(ConsoleWidget *console, const QList<AdObject> &object_list, const QModelIndex &parent);
void policy_ou_impl_load_item_data(QStandardItem *item, const AdObject &object);
//Get policy item that is not in All policies folder.
//Get policy index for a given parent that is not in All policies folder.
//It is applied to exclude policy items from All policies folder
//those can be found first
QModelIndex get_ou_child_policy_item(ConsoleWidget *console, const QModelIndex &ou_index, const QString &policy_dn);
QModelIndex get_ou_child_policy_index(ConsoleWidget *console, const QModelIndex &ou_index, const QString &policy_dn);
//Searches OU's index with given dn under "Group policy objects" item
QModelIndex search_gpo_ou_index(ConsoleWidget *console, const QString &ou_dn);

View File

@ -307,7 +307,7 @@ void LinkedPoliciesWidget::modify_gplink(void (*modify_function)(Gplink &, const
}
void LinkedPoliciesWidget::change_policy_icon(const QString &policy_dn, bool is_checked, GplinkOption option) {
QModelIndex target_policy_index = get_ou_child_policy_item(console, console->get_current_scope_item(), policy_dn);
QModelIndex target_policy_index = get_ou_child_policy_index(console, console->get_current_scope_item(), policy_dn);
if (!target_policy_index.isValid())
return;