[Web] Allow to turn off GAL for each domain
This commit is contained in:
parent
0c84b484a5
commit
8dde735a0a
@ -236,6 +236,7 @@ if (isset($_SESSION['mailcow_cc_role'])) {
|
||||
<form data-id="editdomain" class="form-horizontal" role="form" method="post">
|
||||
<input type="hidden" value="0" name="active">
|
||||
<input type="hidden" value="0" name="backupmx">
|
||||
<input type="hidden" value="0" name="gal">
|
||||
<input type="hidden" value="0" name="relay_all_recipients">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="description"><?=$lang['edit']['description'];?></label>
|
||||
@ -299,6 +300,14 @@ if (isset($_SESSION['mailcow_cc_role'])) {
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" value="1" name="gal" <?=(isset($result['gal_int']) && $result['gal_int']=="1") ? "checked" : null;?>> <?=$lang['edit']['gal'];?></label>
|
||||
<small class="help-block"><?=$lang['edit']['gal_info'];?></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="checkbox">
|
||||
|
@ -348,6 +348,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||
$active = intval($_data['active']);
|
||||
$relay_all_recipients = intval($_data['relay_all_recipients']);
|
||||
$backupmx = intval($_data['backupmx']);
|
||||
$gal = intval($_data['gal']);
|
||||
($relay_all_recipients == 1) ? $backupmx = '1' : null;
|
||||
if (!is_valid_domain_name($domain)) {
|
||||
$_SESSION['return'][] = array(
|
||||
@ -391,8 +392,8 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||
);
|
||||
return false;
|
||||
}
|
||||
$stmt = $pdo->prepare("INSERT INTO `domain` (`domain`, `description`, `aliases`, `mailboxes`, `maxquota`, `quota`, `backupmx`, `active`, `relay_all_recipients`)
|
||||
VALUES (:domain, :description, :aliases, :mailboxes, :maxquota, :quota, :backupmx, :active, :relay_all_recipients)");
|
||||
$stmt = $pdo->prepare("INSERT INTO `domain` (`domain`, `description`, `aliases`, `mailboxes`, `maxquota`, `quota`, `backupmx`, `gal`, `active`, `relay_all_recipients`)
|
||||
VALUES (:domain, :description, :aliases, :mailboxes, :maxquota, :quota, :backupmx, :gal, :active, :relay_all_recipients)");
|
||||
$stmt->execute(array(
|
||||
':domain' => $domain,
|
||||
':description' => $description,
|
||||
@ -401,6 +402,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||
':maxquota' => $maxquota,
|
||||
':quota' => $quota,
|
||||
':backupmx' => $backupmx,
|
||||
':gal' => $gal,
|
||||
':active' => $active,
|
||||
':relay_all_recipients' => $relay_all_recipients
|
||||
));
|
||||
@ -1738,13 +1740,26 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||
}
|
||||
if ($_SESSION['mailcow_cc_role'] == "domainadmin" &&
|
||||
hasDomainAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $domain)) {
|
||||
$description = $_data['description'];
|
||||
$active = intval($_data['active']);
|
||||
$is_now = mailbox('get', 'domain_details', $domain);
|
||||
if (!empty($is_now)) {
|
||||
$gal = (isset($_data['gal'])) ? intval($_data['gal']) : $is_now['gal_int'];
|
||||
$description = (!empty($_data['description'])) ? $_data['description'] : $is_now['description'];
|
||||
}
|
||||
else {
|
||||
$_SESSION['return'][] = array(
|
||||
'type' => 'danger',
|
||||
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
||||
'msg' => 'domain_invalid'
|
||||
);
|
||||
continue;
|
||||
}
|
||||
$stmt = $pdo->prepare("UPDATE `domain` SET
|
||||
`description` = :description
|
||||
`description` = :description,
|
||||
`gal` = :gal
|
||||
WHERE `domain` = :domain");
|
||||
$stmt->execute(array(
|
||||
':description' => $description,
|
||||
':gal' => $gal,
|
||||
':domain' => $domain
|
||||
));
|
||||
$_SESSION['return'][] = array(
|
||||
@ -1758,6 +1773,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||
if (!empty($is_now)) {
|
||||
$active = (isset($_data['active'])) ? intval($_data['active']) : $is_now['active_int'];
|
||||
$backupmx = (isset($_data['backupmx'])) ? intval($_data['backupmx']) : $is_now['backupmx_int'];
|
||||
$gal = (isset($_data['gal'])) ? intval($_data['gal']) : $is_now['gal_int'];
|
||||
$relay_all_recipients = (isset($_data['relay_all_recipients'])) ? intval($_data['relay_all_recipients']) : $is_now['relay_all_recipients_int'];
|
||||
$relayhost = (isset($_data['relayhost'])) ? intval($_data['relayhost']) : $is_now['relayhost'];
|
||||
$aliases = (!empty($_data['aliases'])) ? $_data['aliases'] : $is_now['max_num_aliases_for_domain'];
|
||||
@ -1844,6 +1860,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||
$stmt = $pdo->prepare("UPDATE `domain` SET
|
||||
`relay_all_recipients` = :relay_all_recipients,
|
||||
`backupmx` = :backupmx,
|
||||
`gal` = :gal,
|
||||
`active` = :active,
|
||||
`quota` = :quota,
|
||||
`maxquota` = :maxquota,
|
||||
@ -1855,6 +1872,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||
$stmt->execute(array(
|
||||
':relay_all_recipients' => $relay_all_recipients,
|
||||
':backupmx' => $backupmx,
|
||||
':gal' => $gal,
|
||||
':active' => $active,
|
||||
':quota' => $quota,
|
||||
':maxquota' => $maxquota,
|
||||
@ -2789,9 +2807,11 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||
`relayhost`,
|
||||
`relay_all_recipients` as `relay_all_recipients_int`,
|
||||
`backupmx` as `backupmx_int`,
|
||||
`gal` as `gal_int`,
|
||||
`active` as `active_int`,
|
||||
CASE `relay_all_recipients` WHEN 1 THEN '".$lang['mailbox']['yes']."' ELSE '".$lang['mailbox']['no']."' END AS `relay_all_recipients`,
|
||||
CASE `backupmx` WHEN 1 THEN '".$lang['mailbox']['yes']."' ELSE '".$lang['mailbox']['no']."' END AS `backupmx`,
|
||||
CASE `gal` WHEN 1 THEN '".$lang['mailbox']['yes']."' ELSE '".$lang['mailbox']['no']."' END AS `gal`,
|
||||
CASE `active` WHEN 1 THEN '".$lang['mailbox']['yes']."' ELSE '".$lang['mailbox']['no']."' END AS `active`
|
||||
FROM `domain` WHERE `domain`= :domain");
|
||||
$stmt->execute(array(
|
||||
@ -2824,7 +2844,9 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||
$domaindata['max_quota_for_domain'] = $row['quota'] * 1048576;
|
||||
$domaindata['relayhost'] = $row['relayhost'];
|
||||
$domaindata['backupmx'] = $row['backupmx'];
|
||||
$domaindata['gal'] = $row['gal'];
|
||||
$domaindata['backupmx_int'] = $row['backupmx_int'];
|
||||
$domaindata['gal_int'] = $row['gal_int'];
|
||||
$domaindata['rl'] = $rl;
|
||||
$domaindata['active'] = $row['active'];
|
||||
$domaindata['active_int'] = $row['active_int'];
|
||||
|
@ -3,7 +3,7 @@ function init_db_schema() {
|
||||
try {
|
||||
global $pdo;
|
||||
|
||||
$db_version = "14012019_0717";
|
||||
$db_version = "16012019_0717";
|
||||
|
||||
$stmt = $pdo->query("SHOW TABLES LIKE 'versions'");
|
||||
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
@ -181,6 +181,7 @@ function init_db_schema() {
|
||||
"attr" => "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC"
|
||||
),
|
||||
"domain" => array(
|
||||
// Todo: Move some attributes to json
|
||||
"cols" => array(
|
||||
"domain" => "VARCHAR(255) NOT NULL",
|
||||
"description" => "VARCHAR(255)",
|
||||
@ -190,6 +191,7 @@ function init_db_schema() {
|
||||
"quota" => "BIGINT(20) NOT NULL DEFAULT '102400'",
|
||||
"relayhost" => "VARCHAR(255) NOT NULL DEFAULT '0'",
|
||||
"backupmx" => "TINYINT(1) NOT NULL DEFAULT '0'",
|
||||
"gal" => "TINYINT(1) NOT NULL DEFAULT '1'",
|
||||
"relay_all_recipients" => "TINYINT(1) NOT NULL DEFAULT '0'",
|
||||
"created" => "DATETIME(0) NOT NULL DEFAULT NOW(0)",
|
||||
"modified" => "DATETIME ON UPDATE CURRENT_TIMESTAMP",
|
||||
|
@ -344,6 +344,8 @@ $lang['edit']['max_mailboxes'] = 'Max. Mailboxanzahl:';
|
||||
$lang['edit']['title'] = 'Objekt bearbeiten';
|
||||
$lang['edit']['target_address'] = 'Ziel-Adresse(n) <small>(getrennt durch Komma)</small>:';
|
||||
$lang['edit']['active'] = 'Aktiv';
|
||||
$lang['edit']['gal'] = 'Globales Adressbuch';
|
||||
$lang['edit']['gal_info'] = 'Das Globale Adressbuch enthält alle Objekte einer Domain und kann durch keinen Benutzer editiert werden. <b>Zum Anwenden einer Änderung muss SOGo neugestartet werden.</b>';
|
||||
$lang['edit']['force_pw_update'] = 'Erzwinge Passwortänderung bei nächstem Login';
|
||||
$lang['edit']['force_pw_update_info'] = 'Dem Benutzer wird lediglich der Zugang zur mailcow UI ermöglicht.';
|
||||
$lang['edit']['sogo_access'] = 'SOGo Zugriffsrecht';
|
||||
|
@ -357,6 +357,8 @@ $lang['edit']['max_mailboxes'] = 'Max. possible mailboxes';
|
||||
$lang['edit']['title'] = 'Edit object';
|
||||
$lang['edit']['target_address'] = 'Goto address/es <small>(comma-separated)</small>';
|
||||
$lang['edit']['active'] = 'Active';
|
||||
$lang['edit']['gal'] = 'Global Address List';
|
||||
$lang['edit']['gal_info'] = 'The GAL contains all objects of a domain and cannot be edited by any user. <b>Restart SOGo to apply changes.</b>';
|
||||
$lang['edit']['force_pw_update'] = 'Force password update at next login';
|
||||
$lang['edit']['force_pw_update_info'] = 'This user will only be able to login to mailcow UI.';
|
||||
$lang['edit']['sogo_access'] = 'Grant access to SOGo';
|
||||
|
Loading…
Reference in New Issue
Block a user