Bug 477056

Summary: Support the use case of requiring authenticate to restart/shut down etc.
Product: [Plasma] plasmashell Reporter: Michael Tsang <miklcct>
Component: Session ManagementAssignee: Plasma Bugs List <plasma-bugs-null>
Status: CONFIRMED ---    
Severity: wishlist CC: natalie_clarius, nate
Priority: NOR    
Version First Reported In: 5.27.5   
Target Milestone: 1.0   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Michael Tsang 2023-11-15 17:07:30 UTC
SUMMARY
Restart button does not prompt for authentication even if I set PolicyKit to require admin authentication to restart, and freezes at a black screen after using it.


STEPS TO REPRODUCE
1. Install the following PolicyKit rules:

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.power-off" ||
        action.id == "org.freedesktop.login1.power-off-ignore-inhibit" ||
        action.id == "org.freedesktop.login1.power-off-multiple-sessions" ||
        action.id == "org.freedesktop.login1.reboot" ||
        action.id == "org.freedesktop.login1.reboot-ignore-inhibit" ||
        action.id == "org.freedesktop.login1.reboot-multiple-sessions" ||
        action.id == "org.freedesktop.login1.set-reboot-parameter" ||
        action.id == "org.freedesktop.login1.set-reboot-to-firmware-setup" ||
        action.id == "org.freedesktop.login1.set-reboot-to-boot-loader-menu" ||
        action.id == "org.freedesktop.login1.set-reboot-to-boot-loader-entry" ||
        action.id == "org.freedesktop.login1.suspend" ||
        action.id == "org.freedesktop.login1.suspend-ignore-inhibit" ||
        action.id == "org.freedesktop.login1.suspend-multiple-sessions" ||
        action.id == "org.freedesktop.login1.hibernate" ||
        action.id == "org.freedesktop.login1.hibernate-ignore-inhibit" ||
        action.id == "org.freedesktop.login1.hibernate-multiple-sessions"
    ) {
        return polkit.Result.AUTH_ADMIN;
    }
});

2. Verify that it works by issuing `pkcheck -u -p $$ -a org.freedesktop.login1.reboot; echo $?` in bash in a terminal in the Plasma desktop environment. It should prompt for an authentication.

3. Restart the system from the start menu

OBSERVED RESULT
It does not prompt for authentication. After choosing the option, the screen goes black and freezes. It only regains responsiveness by signing into another terminal and kill plasma-shutdown process.

EXPECTED RESULT
It prompts for authentication, if succeed it restarts the system.


SOFTWARE/OS VERSIONS
Debian GNU/Linux 12
Linux Version: 6.1.0-13-amd64
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Graphics Platform: X11

ADDITIONAL INFORMATION