-
Notifications
You must be signed in to change notification settings - Fork 27
PSO fixes #452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
PSO fixes #452
Changes from all commits
c98b835
5a27558
735e9b2
6cd6d50
96d9a09
b157644
f07efef
171ddd4
36b1c89
d4241cd
a9d08f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| /* | ||
| * ADMC - AD Management Center | ||
| * | ||
| * Copyright (C) 2020-2025 BaseALT Ltd. | ||
| * Copyright (C) 2020-2025 Dmitry Degtyarev | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you need to put here another line with copyright date and your name, if you are one of the authors of the file. |
||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #include "console_impls/password_settings_impl.h" | ||
|
|
||
| #include "ad_defines.h" | ||
| #include "adldap.h" | ||
| #include "console_impls/item_type.h" | ||
| #include "console_impls/object_impl/object_impl.h" | ||
| #include "console_impls/policy_impl.h" | ||
| #include "console_widget/results_view.h" | ||
| #include "create_dialogs/create_policy_dialog.h" | ||
| #include "fsmo/fsmo_utils.h" | ||
| #include "globals.h" | ||
| #include "object_impl/console_object_operations.h" | ||
| #include "results_widgets/pso_results_widget/pso_results_widget.h" | ||
| #include "status.h" | ||
| #include "utils.h" | ||
|
|
||
| #include <QAction> | ||
| #include <QList> | ||
| #include <QMessageBox> | ||
| #include <QStandardItem> | ||
|
|
||
| PasswordSettingsImpl::PasswordSettingsImpl(ConsoleWidget *console_arg) | ||
| : ConsoleImpl(console_arg) { | ||
| set_results_widget(new PSOResultsWidget(console_arg)); | ||
|
|
||
| create_pso_action = new QAction(tr("Create password settings object"), this); | ||
|
|
||
| connect( | ||
| create_pso_action, &QAction::triggered, | ||
| this, [this]() { | ||
| const QString parent_dn = get_selected_target_dn(console, ItemType_PasswordSettings, ObjectRole_DN); | ||
| ConsoleObjectTreeOperations::console_object_create({console}, CLASS_PSO, parent_dn); | ||
| }); | ||
| } | ||
|
|
||
| void PasswordSettingsImpl::fetch(const QModelIndex &index) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd put a Doxygen comment before methods, to document what the method does, what it accepts as parameters, what it asserts (if it does so) and what it returns. Also, if there are any exceptions that can be thrown in the method, I'd document them too. |
||
| AdInterface ad; | ||
| if (ad_failed(ad, console)) { | ||
| return; | ||
| } | ||
|
|
||
| const QString base = g_adconfig->pso_container_dn(); | ||
| const SearchScope scope = SearchScope_Children; | ||
| const QString filter = filter_CONDITION(Condition_Equals, ATTRIBUTE_OBJECT_CLASS, CLASS_PSO_CONTAINER); | ||
| const QList<QString> attributes = QList<QString>(); | ||
| const QHash<QString, AdObject> results = ad.search(base, scope, "", attributes); | ||
|
|
||
| ConsoleObjectTreeOperations::add_objects_to_console(console, results.values(), index); | ||
| } | ||
|
|
||
| void PasswordSettingsImpl::refresh(const QList<QModelIndex> &index_list) { | ||
| const QModelIndex index = index_list[0]; | ||
|
|
||
| console->delete_children(index); | ||
| fetch(index); | ||
| } | ||
|
|
||
| QList<QAction *> PasswordSettingsImpl::get_all_custom_actions() const { | ||
| QList<QAction *> out; | ||
|
|
||
| out.append(create_pso_action); | ||
|
|
||
| return out; | ||
| } | ||
|
|
||
| QSet<QAction *> PasswordSettingsImpl::get_custom_actions(const QModelIndex &index, const bool single_selection) const { | ||
| UNUSED_ARG(index); | ||
| UNUSED_ARG(single_selection); | ||
|
|
||
| QSet<QAction *> out; | ||
|
|
||
| out.insert(create_pso_action); | ||
|
|
||
| return out; | ||
| } | ||
|
|
||
| QSet<StandardAction> PasswordSettingsImpl::get_standard_actions(const QModelIndex &index, const bool single_selection) const { | ||
| UNUSED_ARG(index); | ||
| UNUSED_ARG(single_selection); | ||
|
|
||
| QSet<StandardAction> out; | ||
|
|
||
| out.insert(StandardAction_Refresh); | ||
|
|
||
| return out; | ||
| } | ||
|
|
||
| QList<QString> PasswordSettingsImpl::column_labels() const { | ||
| return ConsoleObjectTreeOperations::object_impl_column_labels(); | ||
| } | ||
|
|
||
| QList<int> PasswordSettingsImpl::default_columns() const { | ||
| return ConsoleObjectTreeOperations::object_impl_default_columns(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /* | ||
| * ADMC - AD Management Center | ||
| * | ||
| * Copyright (C) 2020-2025 BaseALT Ltd. | ||
| * Copyright (C) 2020-2025 Dmitry Degtyarev | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same comment about the copyright header here. |
||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #ifndef PASSWORD_SETTINGS_IMPL_H | ||
| #define PASSWORD_SETTINGS_IMPL_H | ||
|
|
||
| /** | ||
| * Impl for a virtual container for "All policies". Displays | ||
| * all of the policies present in the domain. | ||
| */ | ||
|
|
||
| #include "console_widget/console_impl.h" | ||
| #include "console_widget/console_widget.h" | ||
|
|
||
| class AdObject; | ||
| class AdInterface; | ||
|
|
||
| class PasswordSettingsImpl final : public ConsoleImpl { | ||
| Q_OBJECT | ||
|
|
||
| public: | ||
| PasswordSettingsImpl(ConsoleWidget *console_arg); | ||
|
|
||
| void fetch(const QModelIndex &index) override; | ||
| void refresh(const QList<QModelIndex> &index_list) override; | ||
|
|
||
| QList<QAction *> get_all_custom_actions() const override; | ||
| QSet<QAction *> get_custom_actions(const QModelIndex &index, const bool single_selection) const override; | ||
| QSet<StandardAction> get_standard_actions(const QModelIndex &index, const bool single_selection) const override; | ||
|
|
||
| QList<QString> column_labels() const override; | ||
| QList<int> default_columns() const override; | ||
|
|
||
| private: | ||
| QAction *create_pso_action; | ||
| }; | ||
|
|
||
| #endif /* PASSWORD_SETTINGS_IMPL_H */ | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did u move that commit to another PR?