From 58e67258fbdf0ebf366bb6ab325b4b9f492f526b Mon Sep 17 00:00:00 2001 From: Semyon Knyazev Date: Thu, 19 Sep 2024 03:28:45 +0400 Subject: [PATCH] Update ad_security_get_right_list_for_class() function --- src/adldap/ad_security.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/adldap/ad_security.cpp b/src/adldap/ad_security.cpp index f05f5acf..6c217827 100644 --- a/src/adldap/ad_security.cpp +++ b/src/adldap/ad_security.cpp @@ -951,7 +951,31 @@ void security_descriptor_remove_right(security_descriptor *sd, AdConfig *adconfi } QList ad_security_get_right_list_for_class(AdConfig *adconfig, const QList &class_list) { - QList out = ad_security_get_common_rights() + ad_security_get_extended_rights_for_class(adconfig, class_list); + const QString obj_class = class_list.last(); + + QList permissionable_attrs_rights; + for (const QString &attribute : adconfig->get_permissionable_attributes(obj_class)) { + permissionable_attrs_rights.append(read_write_property_rights(adconfig, attribute)); + } + + QList common_task_rights; + QList child_objects_rights; + for (const QString &obj_class : adconfig->all_inferiors_list(obj_class)) { + child_objects_rights.append(creation_deletion_rights_for_class(adconfig, obj_class)); + + if (common_task_manager->class_common_task_rights_map.keys().contains(obj_class)) { + QList obj_class_rights = common_task_manager->rights_for_class(obj_class); + for (const SecurityRight &right : obj_class_rights) { + if (!child_objects_rights.contains(right)) { + common_task_rights.append(right); + } + } + } + } + + QList out = ad_security_get_common_rights() + ad_security_get_extended_rights_for_class(adconfig, class_list) + + permissionable_attrs_rights + child_objects_rights + common_task_rights; + return out; }