From 1e98c77fdab94bb49da0fe1ad5dbd9fe11871bea Mon Sep 17 00:00:00 2001 From: Yutao Meng Date: Fri, 26 Jul 2024 16:24:19 +0800 Subject: [PATCH] feat: Skip authentication when removing packages by application-wizard Issue: https://github.com/linuxdeepin/developer-center/issues/9432 Log: Skip authentication when removing packages by application-wizard --- CMakeLists.txt | 1 + .../rules.d/org.deepin.dde.application-wizard.rules | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 polkit-1/rules.d/org.deepin.dde.application-wizard.rules diff --git a/CMakeLists.txt b/CMakeLists.txt index de6be81..53c6130 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,4 +72,5 @@ target_link_libraries(${BIN_NAME} PRIVATE ) install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}) +install(FILES polkit-1/rules.d/org.deepin.dde.application-wizard.rules DESTINATION ${CMAKE_INSTALL_DATADIR}/polkit-1/rules.d) install(FILES ${TRANSLATED_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/dde-application-wizard/translations) diff --git a/polkit-1/rules.d/org.deepin.dde.application-wizard.rules b/polkit-1/rules.d/org.deepin.dde.application-wizard.rules new file mode 100644 index 0000000..3f4490a --- /dev/null +++ b/polkit-1/rules.d/org.deepin.dde.application-wizard.rules @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +polkit.addRule(function(action, subject) { + if ((action.id == "org.freedesktop.packagekit.package-remove") && + subject.active == true && subject.local == true && + subject.isInGroup("sudo")) { + return polkit.Result.YES; + } +});