diff --git a/nethserver-profilemgr.spec b/nethserver-profilemgr.spec index 5086949..068833b 100644 --- a/nethserver-profilemgr.spec +++ b/nethserver-profilemgr.spec @@ -1,10 +1,10 @@ Name: nethserver-profilemgr -Summary: Utilities to help administrators manage user profiles. -Version: 0.9.9 +Summary: Utilities to help administrators manage user profiles +Version: 1.0.0 Release: 1.ns6 -URL: https://github.com/libreschool/nethserver-profilemgr +URL: https://git.sys42.eu/syntaxerrormmm/nethserver-profilemgr License: GPLv3+ -Packager: Emiliano Vavassori +Packager: "Emiliano Vavassori " Group: System Environment/Libraries BuildRoot: %{_tmppath}/%{name}-root BuildRequires: nethserver-devtools > 1.0.1 @@ -35,7 +35,9 @@ rm -rf %{buildroot} %defattr(0644,root,root,755) %doc README.md LICENSE.txt - %changelog +* Tue Jul 17 2018 Emiliano Vavassori - 1.0.0-1.ns6 +- First version with tentative GUI. + * Sun Mar 18 2018 Emiliano Vavassori - 0.9.9-1 - First version, commands can be launched only in CLI mode via signal-event. diff --git a/root/usr/share/nethesis/NethServer/Help/en/NethServer_Module_Profile.rst b/root/usr/share/nethesis/NethServer/Help/en/NethServer_Module_Profile.rst new file mode 100644 index 0000000..c438b94 --- /dev/null +++ b/root/usr/share/nethesis/NethServer/Help/en/NethServer_Module_Profile.rst @@ -0,0 +1,43 @@ +========= +Profiles +========= + +This section of the management helps the administrator fixing some little +issues arising within the users' profile. + +Actions +======= + +Here's the actions you can apply on a single user profile. For best results, +the following actions should be applied when the user is not logged in for +best results. + +Complete profile cleanup +------------------------ + +If you want to restore the settings for a user to the default ones (just right +after the user was created inside the system) use this action. + +**BE AWARE** that using this function will remove *all* the users' file, so if +you want to keep some of the files created by the user, you should back them +up or transfer them in other ways. + +Cleanup GUI settings +-------------------- + +Sometimes users will choose the wrong GUI settings, resulting in a crippled or +not working setup. This action will cleanup most of the graphics messes, +*maintaining* the users file. + +Cleanup LibreOffice settings +---------------------------- + +Usually during LibreOffice upgrades (for example 5.x to 6.x branches) could +happen that LibreOffice interface will not work or LO application will not +appear on the desktop of the user: this action will cleanup all the settings +for LibreOffice which the user may have inadvertently set up and thus limiting +the correct work of LibreOffice. + +**Be aware** that this action will remove all the user settings for +LibreOffice, so if the user had a specific dictionary (for example), you +should back it up before using this action. diff --git a/root/usr/share/nethesis/NethServer/Help/it/NethServer_Module_Profile.rst b/root/usr/share/nethesis/NethServer/Help/it/NethServer_Module_Profile.rst new file mode 100644 index 0000000..ca8b36d --- /dev/null +++ b/root/usr/share/nethesis/NethServer/Help/it/NethServer_Module_Profile.rst @@ -0,0 +1,44 @@ +======================== +Gestione profili utente +======================== + +Questa sezione aiuta l'amministratore a risolvere alcuni piccoli problemi con +i profili degli utenti. + +Operazioni +========== + +Ecco la lista delle operazioni che possono essere svolte sul singolo profilo +utente. Per un risultato ottimale, dovrebbero essere applicate mentre l'utente +non è loggato al sistema. + +Pulizia completa +---------------- + +Se si vuole ripristinare le impostazioni di un utente a quelle di default +(come se l'utente fosse stato appena generato a sistema), si può utilizzare +questa operazione. + +**ATTENZIONE**: questa operazione rimuoverà *tutti* i file dell'utente, quindi +se si vuole mantenere alcuni dei file creati dall'utente sarà necessario farne +una copia prima o trasferirli in altre maniere. + +Pulizia imp. grafiche +--------------------- + +A volte gli utenti scelgono impostazioni di interfaccia grafica sbagliate, che +risultano in un ambiente grafico non correttamente funzionante. Questa +operazione pulirà la maggior parte dei problemi dell'ambiente grafico. + +Pulizia imp. LibreOffice +------------------------ + +Durante gli aggiornamenti di LibreOffice (per esempio dalla 5.x alla 6.x) +potrebbe succedere che l'interfaccia di LibreOffice non funzioni correttamente +o non appaia. Questa operazione rimuove tutte le impostazioni che l'utente +potrebbe aver settato e che limitano il corretto funzionamento di LibreOffice. + +**Fate attenzione** che la presente sezione rimuoverà tutte le impostazioni +utente di LibreOffice, per cui se l'utente ha, per esempio, un dizionario +personale, sarà necessario fare una copia dello stesso prima di lanciare +l'operazione. diff --git a/root/usr/share/nethesis/NethServer/Language/en/NethServer_Module_Profile.php b/root/usr/share/nethesis/NethServer/Language/en/NethServer_Module_Profile.php new file mode 100644 index 0000000..df0e450 --- /dev/null +++ b/root/usr/share/nethesis/NethServer/Language/en/NethServer_Module_Profile.php @@ -0,0 +1,16 @@ +. + */ + +class Profile extends \Nethgui\Controller\TableController +{ + + protected function initializeAttributes(\Nethgui\Module\ModuleAttributesInterface $base) + { + return \Nethgui\Module\CompositeModuleAttributesProvider::extendModuleAttributes($base, 'Management', 10)->extendFromComposite($this); + } + + public function initialize() + { + $columns = array( + 'Key', + 'FirstName', + 'LastName', + 'Actions', + ); + + $this + ->setTableAdapter($this->getPlatform()->getTableAdapter('accounts', 'user')) + ->setColumns($columns) + ->addTableAction(new \Nethgui\Controller\Table\Help('Help')) + ->addRowAction(new Profile\Clean('all')) + ->addRowAction(new Profile\Clean('gui')) + ->addRowAction(new Profile\Clean('libreoffice')); + + parent::initialize(); + } + +} diff --git a/root/usr/share/nethesis/NethServer/Module/Profile/Clean.php b/root/usr/share/nethesis/NethServer/Module/Profile/Clean.php new file mode 100644 index 0000000..f73e3db --- /dev/null +++ b/root/usr/share/nethesis/NethServer/Module/Profile/Clean.php @@ -0,0 +1,80 @@ +. + */ + +use Nethgui\System\PlatformInterface as Validate; + +/** + * Manages profile + * + * Fires events + * - profile-clean + * - profile-gui-clean + * - profile-lo-clean + */ +class Clean extends \Nethgui\Controller\Table\AbstractAction +{ + + public function __construct($identifier = NULL) + { + if ($identifier !== 'all' && $identifier !== 'gui' && $identifier !== 'libreoffice') { + throw new \InvalidArgumentException(sprintf('%s: module identifier must be one of "all", "gui" or "libreoffice".', get_class($this)), 1325579395); + } + parent::__construct($identifier); + } + + public function bind(\Nethgui\Controller\RequestInterface $request) + { + $this->declareParameter('username', Validate::USERNAME); + + parent::bind($request); + $username = \Nethgui\array_end($request->getPath()); + + if ( ! $username) { + throw new \Nethgui\Exception\HttpException('Not found', 404, 1322148400); + } + + $this->parameters['username'] = $username; + } + + public function process() + { + if ( ! $this->getRequest()->isMutation()) { + return; + } + + $event = "libreoffice"; // it is the less impacting. + switch ($this->getIdentifier()) { + case "all": + $event = "profile-clean"; + break; + case "gui": + $event = "profile-gui-clean"; + break; + case "libreoffice": + $event = "profile-lo-clean"; + break; + } + + $this->getPlatform()->signalEvent(sprintf("%s@post", $event), array($this->parameters['username'])); + } + +} diff --git a/root/usr/share/nethesis/NethServer/Template/Profile/Clean.php b/root/usr/share/nethesis/NethServer/Template/Profile/Clean.php new file mode 100644 index 0000000..06000ca --- /dev/null +++ b/root/usr/share/nethesis/NethServer/Template/Profile/Clean.php @@ -0,0 +1,27 @@ +requireFlag($view::INSET_DIALOG); + +switch ($view->getModule()->getIdentifier()) { + case "all": + $headerText = $T('Complete profile cleanup - `${0}`'); + $panelText = $T('Proceed with the complete profile cleanup for user `${0}`?'); + break; + case "gui": + $headerText = $T('Cleanup GUI settings - `${0}`'); + $panelText = $T('Proceed with the removal of GUI settings for user `${0}`?'); + break; + case "libreoffice": + $headerText = $T('Cleanup of LibreOffice settings - `${0}`'); + $panelText = $T('Proceed with the removal of LibreOffice settings for user `${0}`?'); + break; +} + +echo $view->panel() + ->insert($view->header('username')->setAttribute('template', $headerText)) + ->insert($view->textLabel('username')->setAttribute('template', $panelText)) +; + +echo $view->buttonList() + ->insert($view->button('Yes', $view::BUTTON_SUBMIT)) + ->insert($view->button('No', $view::BUTTON_CANCEL)->setAttribute('value', $view['Cancel'])) +;