First try with a GUI.

This commit is contained in:
Emiliano Vavassori 2018-07-17 22:41:06 +02:00
parent fb78c4431e
commit ce625c324a
8 changed files with 284 additions and 5 deletions

View File

@ -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 <syntaxerrormmm@gmail.com>
Packager: "Emiliano Vavassori <syntaxerrormmm@gmail.com>"
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 <syntaxerrormmm@gmail.com> - 1.0.0-1.ns6
- First version with tentative GUI.
* Sun Mar 18 2018 Emiliano Vavassori <syntaxerrormmm@gmail.com> - 0.9.9-1
- First version, commands can be launched only in CLI mode via signal-event.

View File

@ -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.

View File

@ -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.

View File

@ -0,0 +1,16 @@
<?php
$L['Profile_Title'] = 'User profiles';
$L['Key_label'] = 'User';
$L['FirstName_label'] = 'First Name';
$L['LastName_label'] = 'Last Name';
$L['Actions_label'] = 'Actions';
$L['all_label'] = "Complete profile cleanup";
$L['gui_label'] = "Cleanup GUI settings";
$L['libreoffice_label'] = "Cleanup LibreOffice settings";
#$L['Complete profile cleanup - `${0}`'] = '';
#$L['Proceed with the complete profile cleanup for user `${0}`?'] = "";
#$L['Cleanup GUI settings - `${0}`'] = "";
#$L['Proceed with the removal of GUI settings for user `${0}`?'] = "";
#$L['Cleanup of LibreOffice settings - `${0}`'] = "";
#$L['Proceed with the removal of LibreOffice settings for user `${0}`?'] = "";

View File

@ -0,0 +1,16 @@
<?php
$L['Profile_Title'] = 'Profili utente';
$L['Key_label'] = 'Utente';
$L['FirstName_label'] = 'Nome';
$L['LastName_label'] = 'Cognome';
$L['Actions_label'] = 'Operazione';
$L['all_label'] = "Pulizia completa";
$L['gui_label'] = "Pulizia imp. grafiche";
$L['libreoffice_label'] = "Pulizia imp. LibreOffice";
$L['Complete profile cleanup - `${0}`'] = 'Pulizia completa - `${0}`';
$L['Proceed with the complete profile cleanup for user `${0}`?'] = 'Procedere con la pulizia completa del profilo per l\'utente `${0}`?';
$L['Cleanup GUI settings - `${0}`'] = 'Pulizia imp. grafiche - `${0}`';
$L['Proceed with the removal of GUI settings for user `${0}`?'] = 'Procedere con la pulizia delle impostazioni grafiche del profilo dell\'utente `${0}`?';
$L['Cleanup of LibreOffice settings - `${0}`'] = 'Pulizia imp. LibreOffice - `${0}`';
$L['Proceed with the removal of LibreOffice settings for user `${0}`?'] = 'Procedere con la pulizia delle impostazioni di LibreOffice dell\'utente `${0}`?';

View File

@ -0,0 +1,51 @@
<?php
namespace NethServer\Module;
/*
* Copyright (C) 2018 LibreSchool
*
* This script is part of the LibreSchool Project.
*
* This 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 project 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 LibreSchool stuff. If not, see <http://www.gnu.org/licenses/>.
*/
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();
}
}

View File

@ -0,0 +1,80 @@
<?php
namespace NethServer\Module\Profile;
/*
* Copyright (C) 2018 LibreSchool Project
*
* This script is part of the LibreSchool Project.
*
* This 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 software 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 LibreSchool stuff. If not, see <http://www.gnu.org/licenses/>.
*/
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']));
}
}

View File

@ -0,0 +1,27 @@
<?php
$view->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']))
;