Skip to content

Commit

Permalink
[SmarterMail100] Added a Default Domain Host name and dropped Inherit…
Browse files Browse the repository at this point in the history
…DefaultLimits from provider settings
  • Loading branch information
FuseCP-TRobinson committed Nov 22, 2024
1 parent c138ec5 commit 47c0c0c
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 50 deletions.
7 changes: 7 additions & 0 deletions SolidCP/Database/update_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20338,4 +20338,11 @@ BEGIN
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (1902, N'RecordMinimumTTL', N'3600')
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (1903, N'RecordMinimumTTL', N'3600')
END
GO

--SmarterMail100 Support for new options
IF NOT EXISTS (SELECT * FROM [dbo].[ServiceDefaultProperties] WHERE [ProviderID] = '67' AND [PropertyName] = N'DomainHostName')
BEGIN
INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (67, N'DefaultDomainHostName', N'mail.[DOMAIN_NAME]')
END
GO
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,6 @@ protected bool ImportDomainAdmin
}
}

protected bool InheritDomainDefaultLimits
{
get
{
bool res;
bool.TryParse(ProviderSettings[Constants.InheritDomainDefaultLimits], out res);
return res;
}
}

protected bool EnableDomainAdministrators
{
get
Expand Down Expand Up @@ -118,10 +108,16 @@ protected string ServiceUrl
{
get { return ProviderSettings["ServiceUrl"]; }
}
#endregion

#region Constants
public const string SYSTEM_DOMAIN_ADMIN = "system.domain.admin";
protected string DefaultDomainHostName
{
get { return ProviderSettings["DefaultDomainHostName"]; }
}

#endregion

#region Constants
public const string SYSTEM_DOMAIN_ADMIN = "system.domain.admin";
public const string SYSTEM_CATCH_ALL = "system.catch.all";
#endregion

Expand Down Expand Up @@ -557,12 +553,20 @@ public void CreateDomain(MailDomain domain)
{
try
{
string domainHostname = "mail." + domain.Name;


if (DefaultDomainHostName.Length > 0)
{
domainHostname = DefaultDomainHostName.ToLower().Replace("[domain_name]", domain.Name);
}

var domainDataArray = new
{
name = domain.Name,
path = DomainsPath + "\\" + domain.Name,
hostname = "mail." + domain.Name,
isEnabled = domain.Enabled.ToString(),
hostname = domainHostname,
isEnabled = domain.Enabled.ToString(),
userLimit = domain.MaxDomainUsers,
domainAliasCount = domain.MaxDomainAliases,
listLimit = domain.MaxLists,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@
</tr>
<tr>
<td></td>
<td><asp:CheckBox runat="server" ID="cbInheritDefaultLimits" meta:resourcekey="cbInheritDefaultLimits"/></td>
<td><asp:CheckBox runat="server" ID="cbEnableDomainAdmin" meta:resourcekey="cbEnableDomainAdmin"/></td>
</tr>
<tr>
<td></td>
<td><asp:CheckBox runat="server" ID="cbEnableDomainAdmin" meta:resourcekey="cbEnableDomainAdmin"/></td>
<td class="SubHead">
<asp:Label ID="lblDefaultDomainHostName" runat="server" meta:resourcekey="lblDefaultDomainHostName" Text="Default Domain Hostname:"></asp:Label>
</td>
<td>
<asp:TextBox Runat="server" ID="txtDefaultDomainHostName" CssClass="form-control" Width="200px"></asp:TextBox>
</td>
</tr>

</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public void BindSettings(StringDictionary settings)
ViewState["PWD"] = settings["AdminPassword"];
rowPassword.Visible = ((string)ViewState["PWD"]) != "";
cbImportDomainAdmin.Checked = Utils.ParseBool(settings[Constants.ImportDomainAdmin], false);
cbInheritDefaultLimits.Checked = Utils.ParseBool(settings[Constants.InheritDomainDefaultLimits], false);
cbEnableDomainAdmin.Checked = Utils.ParseBool(settings[Constants.EnableDomainAdministrators], false);
chkSEEnable.Checked = Utils.ParseBool(settings["EnableMailFilter"], false);
txtDefaultDomainHostName.Text = settings["DefaultDomainHostName"];
}

public void SaveSettings(StringDictionary settings)
Expand All @@ -103,9 +103,9 @@ public void SaveSettings(StringDictionary settings)
settings["AdminUsername"] = txtUsername.Text.Trim();
settings["AdminPassword"] = (txtPassword.Text.Length > 0) ? txtPassword.Text : (string)ViewState["PWD"];
settings[Constants.ImportDomainAdmin] = cbImportDomainAdmin.Checked.ToString();
settings[Constants.InheritDomainDefaultLimits] = cbInheritDefaultLimits.Checked.ToString();
settings[Constants.EnableDomainAdministrators] = cbEnableDomainAdmin.Checked.ToString();
settings["EnableMailFilter"] = chkSEEnable.Checked.ToString();
settings["DefaultDomainHostName"] = txtDefaultDomainHostName.Text.Trim();
}

protected void gvSEDestinations_RowCommand(object sender, GridViewCommandEventArgs e)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 47c0c0c

Please sign in to comment.