[Web] Disable login for mailbox users, other SKIP_SOGO checks and fixes

master
andryyy 2020-04-29 10:57:49 +02:00
parent 200167458e
commit 447c207fb9
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
16 changed files with 67 additions and 96 deletions

View File

@ -28,7 +28,9 @@ if (isset($_SESSION['mailcow_cc_role'])) {
<br>
<form class="form-horizontal" data-id="editalias" role="form" method="post">
<input type="hidden" value="0" name="active">
<?php if (getenv('SKIP_SOGO') != "y") { ?>
<input type="hidden" value="0" name="sogo_visible">
<?php } ?>
<div class="form-group">
<label class="control-label col-sm-2" for="address"><?=$lang['edit']['alias'];?></label>
<div class="col-sm-10">
@ -48,17 +50,13 @@ if (isset($_SESSION['mailcow_cc_role'])) {
<div class="checkbox">
<label><input class="goto_checkbox" type="checkbox" value="1" name="goto_ham" <?= ($result['goto'] == "ham@localhost") ? "checked" : null; ?>> <?=$lang['add']['goto_ham'];?></label>
</div>
<?php
if (getenv('SKIP_SOGO') != "y") {
?>
<?php if (getenv('SKIP_SOGO') != "y") { ?>
<hr>
<div class="checkbox">
<label><input type="checkbox" value="1" name="sogo_visible" <?php if (isset($result['sogo_visible_int']) && $result['sogo_visible_int']=="1") { echo "checked"; }; ?>> <?=$lang['edit']['sogo_visible'];?></label>
</div>
<p class="help-block"><?=$lang['edit']['sogo_visible_info'];?></p>
<?php
}
?>
<?php } ?>
</div>
</div>
<hr>
@ -577,7 +575,6 @@ if (isset($_SESSION['mailcow_cc_role'])) {
<h4><?=$lang['edit']['mailbox'];?></h4>
<form class="form-horizontal" data-id="editmailbox" role="form" method="post">
<input type="hidden" value="default" name="sender_acl">
<input type="hidden" value="0" name="active">
<input type="hidden" value="0" name="force_pw_update">
<input type="hidden" value="0" name="sogo_access">
<div class="form-group">
@ -712,9 +709,11 @@ if (isset($_SESSION['mailcow_cc_role'])) {
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label><input type="checkbox" value="1" name="active" <?=($result['active_int']=="1") ? "checked" : null;?>> <?=$lang['edit']['active'];?></label>
</div>
<select name="active" class="form-control">
<option value="1" <?=($result['active_int']=="1") ? 'selected' : null;?>><?=$lang['edit']['active'];?></option>
<option value="2" <?=($result['active_int']=="2") ? 'selected' : null;?>><?=$lang['edit']['disable_login'];?></option>
<option value="0" <?=($result['active_int']=="0") ? 'selected' : null;?>><?=$lang['edit']['inactive'];?></option>
</select>
</div>
</div>
<div class="form-group">
@ -725,9 +724,7 @@ if (isset($_SESSION['mailcow_cc_role'])) {
</div>
</div>
</div>
<?php
if (getenv('SKIP_SOGO') != "y") {
?>
<?php if (getenv('SKIP_SOGO') != "y") { ?>
<div data-acl="<?=$_SESSION['acl']['sogo_access'];?>" class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
@ -736,9 +733,7 @@ if (isset($_SESSION['mailcow_cc_role'])) {
</div>
</div>
</div>
<?php
}
?>
<?php } ?>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button class="btn btn-success" data-action="edit_selected" data-id="editmailbox" data-item="<?=htmlspecialchars($result['username']);?>" data-api-url='edit/mailbox' data-api-attr='{}' href="#"><?=$lang['edit']['save'];?></button>

View File

@ -38,9 +38,9 @@
}
?>
<link rel="stylesheet" href="/cache/<?=basename($CSSPath)?>">
<?php if (strtolower(trim($DEFAULT_THEME)) != "lumen"): ?>
<?php if (strtolower(trim($DEFAULT_THEME)) != "lumen") { ?>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/<?= strtolower(trim($DEFAULT_THEME)); ?>/bootstrap.min.css">
<?php endif; ?>
<?php } ?>
<link rel="shortcut icon" href="/favicon.png" type="image/png">
<link rel="icon" href="/favicon.png" type="image/png">
</head>
@ -91,10 +91,7 @@
if ($_SESSION['mailcow_cc_role'] == 'admin' || $_SESSION['mailcow_cc_role'] == 'domainadmin') {
?>
<li<?= (preg_match("/mailbox/i", $_SERVER['REQUEST_URI'])) ? ' class="active"' : ''; ?>><a href="/mailbox"><?= $lang['header']['mailboxes']; ?></a></li>
<?php
}
if ($_SESSION['mailcow_cc_role'] != 'admin') {
?>
<?php } if ($_SESSION['mailcow_cc_role'] != 'admin') { ?>
<li<?= (preg_match("/user/i", $_SERVER['REQUEST_URI'])) ? ' class="active"' : ''; ?>><a href="/user"><?= $lang['header']['user_settings']; ?></a></li>
<?php
}
@ -102,57 +99,40 @@
?>
</ul>
</li>
<?php
if (isset($_SESSION['mailcow_cc_role'])) {
?>
<?php if (isset($_SESSION['mailcow_cc_role'])) { ?>
<li<?= (preg_match("/quarantine/i", $_SERVER['REQUEST_URI'])) ? ' class="active"' : ''; ?>><a href="/quarantine"><span class="glyphicon glyphicon-briefcase"></span> <?= $lang['header']['quarantine']; ?></a></li>
<?php
}
if ($_SESSION['mailcow_cc_role'] == 'admin' && getenv('SKIP_SOGO') != "y") {
?>
<?php } if ($_SESSION['mailcow_cc_role'] == 'admin' && getenv('SKIP_SOGO') != "y") { ?>
<li><a href data-toggle="modal" data-container="sogo-mailcow" data-target="#RestartContainer"><span class="glyphicon glyphicon-refresh"></span> <?= $lang['header']['restart_sogo']; ?></a></li>
<?php
}
?>
<?php } ?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><span class="glyphicon glyphicon-link"></span> <?= $lang['header']['apps']; ?> <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<?php
foreach ($MAILCOW_APPS as $app):
<?php foreach ($MAILCOW_APPS as $app) {
if (getenv('SKIP_SOGO') == "y" && preg_match('/^\/SOGo/i', $app['link'])) { continue; }
?>
<li title="<?= htmlspecialchars($app['description']); ?>"><a href="<?= htmlspecialchars($app['link']); ?>"><?= htmlspecialchars($app['name']); ?></a></li>
<?php
endforeach;
}
$app_links = customize('get', 'app_links');
if ($app_links) {
foreach ($app_links as $row) {
foreach ($row as $key => $val):
foreach ($row as $key => $val) {
?>
<li><a href="<?= htmlspecialchars($val); ?>"><?= htmlspecialchars($key); ?></a></li>
<?php
endforeach;
}
}
}
?>
</ul>
</li>
<?php
}
if (!isset($_SESSION['dual-login']) && isset($_SESSION['mailcow_cc_username'])):
?>
<?php } if (!isset($_SESSION['dual-login']) && isset($_SESSION['mailcow_cc_username'])) { ?>
<li class="logged-in-as"><a href="#" onclick="logout.submit()"><b class="username-lia"><?= htmlspecialchars($_SESSION['mailcow_cc_username']); ?></b> <span class="glyphicon glyphicon-log-out"></span></a></li>
<?php
elseif (isset($_SESSION['dual-login'])):
?>
<?php } elseif (isset($_SESSION['dual-login'])) { ?>
<li class="logged-in-as"><a href="#" onclick="logout.submit()"><b class="username-lia"><?= htmlspecialchars($_SESSION['mailcow_cc_username']); ?> <span class="text-info">(<?= htmlspecialchars($_SESSION['dual-login']['username']); ?>)</span> </b><span class="glyphicon glyphicon-log-out"></span></a></li>
<?php
endif;
if (!preg_match('/y|yes/i', getenv('MASTER'))):
?>
<?php } if (!preg_match('/y|yes/i', getenv('MASTER'))) { ?>
<li class="text-warning slave-info">[ slave ]</li>
<?php
endif;
?>
<?php } ?>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->

View File

@ -46,6 +46,7 @@
"delete2duplicates": "Lösche Duplikate im Ziel",
"description": "Beschreibung",
"destination": "Ziel",
"disable_login": "Login verbieten",
"domain": "Domain",
"domain_matches_hostname": "Domain %s darf nicht dem Hostnamen entsprechen",
"domain_quota_m": "Domain Speicherplatz gesamt (MiB)",
@ -59,6 +60,7 @@
"goto_null": "Nachrichten sofort verwerfen",
"goto_spam": "Nachrichten als <span class=\"text-danger\"><b>Spam</b></span> lernen",
"hostname": "Host",
"inactive": "Inaktiv",
"kind": "Art",
"mailbox_quota_def": "Standard-Quota einer Mailbox",
"mailbox_quota_m": "Max. Speicherplatz pro Mailbox (MiB)",
@ -454,6 +456,7 @@
"delete2duplicates": "Lösche Duplikate im Ziel",
"delete_ays": "Soll der Löschvorgang wirklich ausgeführt werden?",
"description": "Beschreibung",
"disable_login": "Login verbieten",
"domain": "Domain bearbeiten",
"domain_admin": "Domain-Administrator bearbeiten",
"domain_quota": "Domain Speicherplatz gesamt (MiB)",
@ -472,6 +475,7 @@
"generate": "generieren",
"grant_types": "Grant types",
"hostname": "Servername",
"inactive": "Inaktiv",
"kind": "Art",
"mailbox": "Mailbox bearbeiten",
"mailbox_quota_def": "Standard-Quota einer Mailbox",
@ -613,6 +617,7 @@
"daily": "Täglich",
"deactivate": "Deaktivieren",
"description": "Beschreibung",
"disable_login": "Login verbieten",
"disable_x": "Deaktiviere",
"domain": "Domain",
"domain_admins": "Domain-Administratoren",

View File

@ -46,6 +46,7 @@
"delete2duplicates": "Delete duplicates on destination",
"description": "Description",
"destination": "Destination",
"disable_login": "Disallow login",
"domain": "Domain",
"domain_matches_hostname": "Domain %s matches hostname",
"domain_quota_m": "Total domain quota (MiB)",
@ -59,6 +60,7 @@
"goto_null": "Silently discard mail",
"goto_spam": "Learn as <span class=\"text-danger\"><b>spam</b></span>",
"hostname": "Host",
"inactive": "Inactive",
"kind": "Kind",
"mailbox_quota_def": "Default mailbox quota",
"mailbox_quota_m": "Max. quota per mailbox (MiB)",
@ -453,6 +455,7 @@
"delete2duplicates": "Delete duplicates on destination",
"delete_ays": "Please confirm the deletion process.",
"description": "Description",
"disable_login": "Disallow login",
"domain": "Edit domain",
"domain_admin": "Edit domain administrator",
"domain_quota": "Domain quota",
@ -471,6 +474,7 @@
"generate": "generate",
"grant_types": "Grant types",
"hostname": "Hostname",
"inactive": "Inactive",
"kind": "Kind",
"mailbox": "Edit mailbox",
"mailbox_quota_def": "Default mailbox quota",
@ -612,6 +616,7 @@
"daily": "Daily",
"deactivate": "Deactivate",
"description": "Description",
"disable_login": "Disallow login",
"disable_x": "Disable",
"domain": "Domain",
"domain_admins": "Domain administrators",

View File

@ -388,6 +388,7 @@
"gal_info": "El GAL contiene todos los objetos de un dominio y no puede ser editado por ningún usuario. Falta información de disponibilidad en SOGo, si está desactivada. <b>Reinicia SOGo para aplicar los cambios.</b>",
"grant_types": "Grant types",
"hostname": "Hostname",
"inactive": "Inactivo",
"kind": "Tipo",
"mailbox": "Editar buzón",
"mailbox_quota_def": "Cuota de buzón predeterminada",

View File

@ -437,6 +437,7 @@
"gal_info": "GAL ( kalenteri ) sisältää kaikki verkkotunnus alueen objektit, eikä yksikään käyttäjä voi muokata sitä. Vapaat ja varatut ajat-tiedot SOGosta puuttuu, jos se on poistettu käytöstä! <b>Uudelleen käynnistä SOGo ja ota muutokset käyttöön.</b>",
"grant_types": "Oikeus tyypiy",
"hostname": "Hostname",
"inactive": "Passiivinen",
"kind": "Kiltti",
"mailbox": "Muokkaa sähköposti tiliä",
"mailbox_quota_def": "Sähköpostin oletus kiintiö",

View File

@ -181,6 +181,7 @@
"exclude": "Objets à exclure (expression régulière)",
"full_name": "Nom complet",
"hostname": "Nom d'hôte",
"inactive": "Inactif",
"kind": "Type",
"mailbox": "Éditer la boîte",
"max_aliases": "Alias max.",

View File

@ -228,6 +228,7 @@
"force_pw_update_info": "Šis lietotājs varēs pieslēgties tikai %s.",
"full_name": "Pilns vārds",
"hostname": "Hosta nosaukums",
"inactive": "Neaktīvs",
"kind": "Veids",
"mailbox": "Rediģēt pastkasti",
"max_aliases": "Maks. aliases",

View File

@ -469,6 +469,7 @@
"generate": "genereer",
"grant_types": "Grant types",
"hostname": "Hostname",
"inactive": "Inactief",
"kind": "Soort",
"mailbox": "Wijzig postvak",
"mailbox_quota_def": "Standaard postvakquotum",

View File

@ -162,6 +162,7 @@
"exclude": "Wyklucz obiekty (regex)",
"full_name": "Pełna nazwa",
"hostname": "Nazwa hosta",
"inactive": "Nieaktywny",
"kind": "Rodzaj",
"mailbox": "Edytuj skrzynkę",
"max_aliases": "Maks. liczba aliasów",

View File

@ -468,6 +468,7 @@
"generate": "сгенерировать",
"grant_types": "Разрешено типы",
"hostname": "Имя хоста",
"inactive": "Неактивный",
"kind": "Тип",
"mailbox": "Изменение почтового ящика",
"mailbox_quota_def": "Квота по умолчанию",

View File

@ -466,6 +466,7 @@
"generate": "generovať",
"grant_types": "Typy opravnení",
"hostname": "Hostiteľ",
"inactive": "Neaktívny",
"kind": "Druh",
"mailbox": "Upraviť poštovú schránku",
"mailbox_quota_def": "Predvolená veľkosť poštovej schránky",

View File

@ -472,6 +472,7 @@
"generate": "generera",
"grant_types": "Grant-typer",
"hostname": "Värdnamn",
"inactive": "Inaktiv",
"kind": "Typ",
"mailbox": "Ändra postlåda",
"mailbox_quota_def": "Standard kvot på postlådor",

View File

@ -92,15 +92,11 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
</ul>
</div>
</div>
<?php
if (preg_match("/^([yY][eE][sS]|[yY])+$/", $_ENV["ALLOW_ADMIN_EMAIL_LOGIN"]) && getenv('SKIP_SOGO') != "y"):
?>
<?php if (getenv('ALLOW_ADMIN_EMAIL_LOGIN') == "y" && getenv('SKIP_SOGO') != "y") { ?>
<div class="panel-body help-block">
<?=$lang['mailbox']['sogo_allow_admin_hint'];?>
</div>
<?php
endif;
?>
<?php } ?>
<!-- <div class="mass-actions-mailbox" data-actions-header="true"></div> -->
<div class="table-responsive">
<table id="mailbox_table" class="table table-striped"></table>
@ -256,16 +252,11 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
<li><a data-action="edit_selected" data-id="alias" data-api-url='edit/alias' data-api-attr='{"active":"0"}' href="#"><?=$lang['mailbox']['deactivate'];?></a></li>
<li role="separator" class="divider"></li>
<li><a data-action="delete_selected" data-id="alias" data-api-url='delete/alias' href="#"><?=$lang['mailbox']['remove'];?></a></li>
<?php
if (getenv('SKIP_SOGO') != "y") {
?>
<?php if (getenv('SKIP_SOGO') != "y") { ?>
<li role="separator" class="divider"></li>
<li><a data-action="edit_selected" data-id="alias" data-api-url='edit/alias' data-api-attr='{"sogo_visible":"1"}' href="#"><?=$lang['mailbox']['sogo_visible_y'];?></a></li>
<li><a data-action="edit_selected" data-id="alias" data-api-url='edit/alias' data-api-attr='{"sogo_visible":"0"}' href="#"><?=$lang['mailbox']['sogo_visible_n'];?></a></li>
<?php
}
?>
<?php } ?>
</ul>
<a class="btn btn-sm btn-success" href="#" data-toggle="modal" data-target="#addAliasModal"><span class="glyphicon glyphicon-plus"></span> <?=$lang['mailbox']['add_alias'];?></a>
</div>

View File

@ -62,11 +62,14 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label><input type="checkbox" value="1" name="active" checked> <?=$lang['add']['active'];?></label>
</div>
<select name="active" class="form-control">
<option value="1" selected><?=$lang['add']['active'];?></option>
<option value="2"><?=$lang['add']['disable_login'];?></option>
<option value="0"><?=$lang['add']['inactive'];?></option>
</select>
</div>
</div>
<hr>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button class="btn btn-default" data-action="add_item" data-id="add_mailbox" data-api-url='add/mailbox' data-api-attr='{}' href="#"><?=$lang['admin']['add'];?></button>
@ -129,9 +132,7 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
<input type="number" class="form-control" name="quota" value="10240" required>
</div>
</div>
<?php
if (getenv('SKIP_SOGO') != "y") {
?>
<?php if (getenv('SKIP_SOGO') != "y") { ?>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
@ -140,9 +141,7 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
</div>
</div>
</div>
<?php
}
?>
<?php } ?>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
@ -183,29 +182,18 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
<hr>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<?php
if (getenv('SKIP_SOGO') != "y") {
?>
<?php if (getenv('SKIP_SOGO') != "y") { ?>
<button class="btn btn-default" data-action="add_item" data-id="add_domain" data-api-url='add/domain' data-api-attr='{}' href="#"><?=$lang['add']['add_domain_only'];?></button>
<button class="btn btn-default" data-action="add_item" data-id="add_domain" data-api-url='add/domain' data-api-attr='{"restart_sogo":"1"}' href="#"><?=$lang['add']['add_domain_restart'];?></button>
<?php
}
else {
?>
<?php } else { ?>
<button class="btn btn-default" data-action="add_item" data-id="add_domain" data-api-url='add/domain' data-api-attr='{}' href="#"><?=$lang['add']['add'];?></button>
<?php
}
?>
<?php } ?>
</div>
</div>
<?php
// TODO: Separate SOGo-related text
if (getenv('SKIP_SOGO') != "y") {
?>
<?php // TODO: Separate SOGo-related text
if (getenv('SKIP_SOGO') != "y") { ?>
<p><span class="glyphicon glyphicon-exclamation-sign text-danger"></span> <?=$lang['add']['post_domain_add'];?></p>
<?php
}
?>
<?php } ?>
</form>
</div>
</div>
@ -313,17 +301,13 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
<div class="checkbox">
<label><input class="goto_checkbox" type="checkbox" value="1" name="goto_ham"> <?=$lang['add']['goto_ham'];?></label>
</div>
<?php
if (getenv('SKIP_SOGO') != "y") {
?>
<?php if (getenv('SKIP_SOGO') != "y") { ?>
<hr>
<div class="checkbox">
<label><input type="checkbox" value="1" name="sogo_visible" checked> <?=$lang['edit']['sogo_visible'];?></label>
</div>
<p class="help-block"><?=$lang['edit']['sogo_visible_info'];?></p>
<?php
}
?>
<?php } ?>
</div>
</div>
<div class="form-group">

View File

@ -307,6 +307,7 @@ elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == '
<p class="help-block"><?=$lang['user']['quarantine_notification_info'];?></p>
</div>
</div>
<?php if (getenv('SKIP_SOGO') != "y") { ?>
<hr>
<div class="row">
<div class="col-md-3 col-xs-5 text-right"><?=$lang['user']['eas_reset'];?>:</div>
@ -322,6 +323,7 @@ elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == '
<p class="help-block"><?=$lang['user']['sogo_profile_reset_help'];?></p>
</div>
</div>
<?php } ?>
</div>
</div>
</div>