Bug 407846

Summary: If current user is not in sambashare group (if applicable), offer to fix this and then reboot
Product: [Frameworks and Libraries] kdenetwork-filesharing Reporter: Nate Graham <nate>
Component: generalAssignee: Nate Graham <nate>
Status: RESOLVED FIXED    
Severity: normal CC: bugseforuns, sitter
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=407845
Latest Commit: Version Fixed In: 20.12

Description Nate Graham 2019-05-22 22:06:35 UTC
Some Linux distros (e.g. Arch) require that users whose folders are used as Samba shares be added to the sambashare group.

We should detect when this is not the case and offer to fix it and then reboot (on Linux, group changes require a reboot).
Comment 1 Harald Sitter 2020-03-17 10:31:18 UTC
I'm not sure that's strictly speaking true. The user needs to have write access to the usershare directory so they can create the definition file for the share. We could equally kauth the writing of that file and bypass the group aspect entirely. In fact that may give a much better experience as group assignments need a relog to apply to the session before being able to do anything.
Comment 2 Bug Janitor Service 2020-08-24 11:55:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/kdenetwork-filesharing/-/merge_requests/9
Comment 3 Harald Sitter 2020-08-27 10:07:35 UTC
Git commit 371c590c4dcc61f258f2ab7849f6d5e9ce782cc5 by Harald Sitter.
Committed on 27/08/2020 at 10:07.
Pushed by sitter into branch 'master'.

add a group management page

to edit usershares the user needs to be member of the appropriate group.
detect when that is not the case (dir is not writable) and offer
automatic group management if at all viable (dir isn't group owned by
root and the group looks like something samba related).

to visualize this there's a new group page which is run after
installation and also on every start (it does a fairly cheap check;
never the less it is equipped with busy indication).

should the user not be able to write the usershare directory the user
can ask us to ask the kauth helper to make the necessary changes.

the entire backing logic is inside a groupmanager helper class that
evaluates the group status of the user

this also moves the reboot function back out of the samba installer into
the plugin. the group management also needs to reboot (or at least
re-log) to apply the changes so we need a more global way to issue
reboots
FIXED-IN: 20.12

M  +1    -0    samba/filepropertiesplugin/CMakeLists.txt
M  +47   -0    samba/filepropertiesplugin/authhelper.cpp
M  +1    -0    samba/filepropertiesplugin/authhelper.h
A  +104  -0    samba/filepropertiesplugin/groupmanager.cpp     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
A  +41   -0    samba/filepropertiesplugin/groupmanager.h     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
M  +6    -0    samba/filepropertiesplugin/org.kde.filesharing.samba.actions
A  +68   -0    samba/filepropertiesplugin/qml/GroupPage.qml     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
M  +6    -1    samba/filepropertiesplugin/qml/InstallPage.qml
M  +2    -4    samba/filepropertiesplugin/qml/RebootPage.qml
M  +1    -1    samba/filepropertiesplugin/qml/UserPage.qml
M  +12   -1    samba/filepropertiesplugin/qml/main.qml
M  +1    -0    samba/filepropertiesplugin/qml/qml.qrc
M  +0    -8    samba/filepropertiesplugin/sambainstaller.cpp
M  +0    -1    samba/filepropertiesplugin/sambainstaller.h
M  +11   -0    samba/filepropertiesplugin/sambausershareplugin.cpp
M  +1    -0    samba/filepropertiesplugin/sambausershareplugin.h

https://invent.kde.org/network/kdenetwork-filesharing/commit/371c590c4dcc61f258f2ab7849f6d5e9ce782cc5