* Preferences: always show Security & Password popup, only disable password tab, if no rights to change it

This commit is contained in:
Ralf Becker 2019-09-11 12:15:23 +02:00
parent 619d5a6707
commit e2529ea8a3
6 changed files with 70 additions and 27 deletions

View File

@ -1155,20 +1155,9 @@ abstract class Framework extends Framework\Extra
$this->add_preferences_topmenu('prefs');
$this->add_preferences_topmenu('acl');
$this->add_preferences_topmenu('cats');
$this->add_preferences_topmenu('security');
}
// allways display password in topmenu, if user has rights to change it
if ($GLOBALS['egw_info']['user']['apps']['preferences'] &&
!$GLOBALS['egw']->acl->check('nopasswordchange', 1, 'preferences'))
{
$this->_add_topmenu_item(array(
'id' => 'password',
'name' => 'preferences',
'title' => lang('Security & Password'),
'url' => "javascript:egw.open_link('".
self::link('/index.php?menuaction=preferences.preferences_password.change')."','_blank','850x580')",
));
}
/* disable help until content is reworked
if($GLOBALS['egw_info']['user']['apps']['manual'] && isset($apps['manual']))
{
@ -1224,6 +1213,10 @@ abstract class Framework extends Framework\Extra
'hook' => 'categories',
'run_hook' => true, // acturally run hook, not just look it's implemented
),
'security' => array(
'title' => 'Security & Password',
'hook' => 'preferences_security',
),
);
if (!$GLOBALS['egw_info']['user']['apps']['preferences'] || $GLOBALS['egw_info']['server']['deny_'.$type] &&
array_intersect($memberships, (array)$GLOBALS['egw_info']['server']['deny_'.$type]) &&
@ -1244,12 +1237,31 @@ abstract class Framework extends Framework\Extra
{
$apps = Hooks::implemented($types[$type]['hook']);
}
$this->_add_topmenu_item(array(
'id' => $type,
'name' => 'preferences',
'title' => lang($types[$type]['title']),
'url' => "javascript:egw.show_preferences(\"$type\",".json_encode($apps).')',
));
// allways display password in topmenu, if user has rights to change it
switch ($type)
{
case 'security':
if ($apps || $GLOBALS['egw_info']['server']['2fa_required'] !== 'disabled' ||
!$GLOBALS['egw']->acl->check('nopasswordchange', 1))
{
$this->_add_topmenu_item(array(
'id' => 'password',
'name' => 'preferences',
'title' => lang($types[$type]['title']),
'url' => "javascript:egw.open_link('".
self::link('/index.php?menuaction=preferences.preferences_password.change')."','_blank','850x580')",
));
}
break;
default:
$this->_add_topmenu_item(array(
'id' => $type,
'name' => 'preferences',
'title' => lang($types[$type]['title']),
'url' => "javascript:egw.show_preferences(\"$type\",".json_encode($apps).')',
));
}
}
/**

View File

@ -35,11 +35,7 @@ class preferences_password
*/
function change($content = null)
{
if ($GLOBALS['egw']->acl->check('nopasswordchange', 1))
{
Framework::window_close('Password change is disabled!');
}
$GLOBALS['egw_info']['flags']['app_header'] = lang('Change your password');
$GLOBALS['egw_info']['flags']['app_header'] = lang('Security & Password');
$tmpl = new Etemplate('preferences.password');
$readonlys = $sel_options = [];
@ -78,7 +74,7 @@ class preferences_password
switch($content['tabs'])
{
case 'change_password':
if ($content['button']['save'])
if ($GLOBALS['egw']->acl->check('nopasswordchange', 1) && $content['button']['save'])
{
if (($errors = self::do_change($content['password'], $content['n_passwd'], $content['n_passwd_2'])))
{
@ -159,6 +155,12 @@ class preferences_password
$readonlys['tabs']['two_factor_auth'] = true;
}
// disable password change, if user has not right to change it
if ($GLOBALS['egw']->acl->check('nopasswordchange', 1))
{
$readonlys['tabs']['change_password'] = true;
}
$preserve = [
'2fa' => $content['2fa']+[
'secret_key' => $secret_key,

View File

@ -39,9 +39,10 @@ default font preferences de Standard-Schrift
default font size preferences de Standard-Schriftgröße
default preferences preferences de Voreinstellungen
delete categories preferences de Kategorie löschen
deny following groups access to acl (grant access) admin de verweigere folgenden Gruppen den Zugriff in den ACL's
deny following groups access to edit categories admin de verweigere folgenden Gruppen den Zugriff zum Ändern der Kategorien
deny following groups access to preferences admin de verweigere folgenden Gruppen den Zugang zu den Einstellungen
deny following groups access to acl (grant access) admin de Verweigere folgenden Gruppen den Zugriff in den ACL's
deny following groups access to edit categories admin de Verweigere folgenden Gruppen den Zugriff zum Ändern der Kategorien
deny following groups access to preferences admin de Verweigere folgenden Gruppen den Zugriff zu den Einstellungen
deny following groups access to security popup admin de Verweigere folgenden Gruppen den Zugriff auf das Popup Sicherheit
description can not exceed 255 characters in length ! preferences de Die Beschreibung darf nicht länger als 255 Zeichen sein !
disable preferences de Deaktivieren
disable two factor auth preferences de 2-Faktor-Authentifizierung deaktivieren
@ -145,6 +146,7 @@ selectbox with groupmembers common de Auswahlbox mit Gruppenmitgliedern
selectbox with primary group and search preferences de Auswahlfeld mit primärer Gruppe und Suche
server is unwilling to perform. preferences de Server ist unwillig die Änderung auszuführen.
set this to your convenience. for security reasons, you might not want to show your loginname in public. preferences de Stellen Sie das nach Ihren Vorlieben ein. Aus Sicherheitsgründen sollte der Benutzername nicht in der Öffentlichkeit gezeigt werden.
settings preferences de Einstellungen
setup two factor authentication preferences de Setup 2-Faktor-Authentifizierung
should the number of active sessions be displayed for you all the time. preferences de Zeigt die Anzahl aktiver Sitzungen permanent unten rechts an.
should this help messages shown up always, when you enter the preferences or only on request. preferences de Sollen die Hilfetexte immer angezeigt werden, wenn Sie die Einstellungen aufrufen oder nur auf Anforderung?

View File

@ -42,6 +42,7 @@ delete categories preferences en Delete categories
deny following groups access to acl (grant access) admin en Deny following groups access to ACL (grant access)
deny following groups access to edit categories admin en Deny following groups access to edit categories
deny following groups access to preferences admin en Deny following groups access to preferences
deny following groups access to security popup admin en Deny following groups access to security popup
description can not exceed 255 characters in length ! preferences en Description can not exceed 255 characters in length !
disable preferences en Disable
disable two factor auth preferences en Disable Two Factor Auth

View File

@ -21,6 +21,10 @@
<description value="Deny following groups access to edit categories" label="%s:"/>
<select-account id="newsettings[deny_cats]" account_type="groups" multiple="true" tags="true" width="100%"/>
</row>
<row>
<description value="Deny following groups access to security popup" label="%s:"/>
<select-account id="newsettings[deny_security]" account_type="groups" multiple="true" tags="true" width="100%"/>
</row>
</rows>
</grid>
</template>

View File

@ -103,6 +103,28 @@ textarea.prefValue {
#preferences_settings_country_chzn {
width: 49% !important;
}
/**
* 2FA setup
*/
.securityHeader {
margin-top: 1em;
font-size: 120%;
}
img.qrCode {
position: relative;
left: -14px;
}
.toptApp {
display: list-item !important;
list-style-type: disc;
list-style-position: inside;
white-space: nowrap;
}
.toptStatus {
margin-top: 1em;
font-style: italic;
font-size: 120%;
}
.prefHelp {
width: 100%;
height: 60px;