Fixing missing policy for autocreated user when parent domain has none. Patch was send by gfa.

This commit is contained in:
Mikko Husari 2009-09-02 20:39:02 +03:00
parent ce2f9b9925
commit 8db05c4b56
2 changed files with 15 additions and 0 deletions

View File

@ -467,6 +467,10 @@ $conf['app']['autocreate_wbl_users'] = true;
$conf['app']['release_when_listing'] = true; $conf['app']['release_when_listing'] = true;
$conf['app']['delete_when_listing'] = true; $conf['app']['delete_when_listing'] = true;
// Use database defaults when auto-creating users
// if there is no domain policy set
$conf['app']['use_sql_defaults'] = true;
include_once('init.php'); include_once('init.php');
?> ?>

View File

@ -824,7 +824,18 @@ class DBEngine {
/* /*
2. Insert new user 2. Insert new user
*/ */
if($policy == NULL) {
if($conf['app']['use_sql_defaults']) {
$query = 'insert into users (email, fullname) values ( ?, "mailzu autocreated user")';
$policy = array($recip_email);
} else {
CmnFns::do_error_box('Domain policy not set' //should be translated
.'<br />' . '<a href="javascript: history.back();">'
.translate('Back') . '</a>');
}
} else {
$query = 'insert into users (priority, policy_id, email, fullname, local) values (?, ?, ?, "mailzu autocreated user", ?);'; $query = 'insert into users (priority, policy_id, email, fullname, local) values (?, ?, ?, "mailzu autocreated user", ?);';
}
$q = $this->db->prepare($query); $q = $this->db->prepare($query);
$result = $this->db->execute($q, $policy); $result = $this->db->execute($q, $policy);
$this->check_for_error($result, $query); $this->check_for_error($result, $query);