wsp-10106: Implement Exchange Tenant Disclaimer.
This commit is contained in:
parent
eee5d732fb
commit
0ec87fc5f4
28 changed files with 11296 additions and 7215 deletions
|
@ -2679,6 +2679,98 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
#endregion
|
||||
|
||||
#region Exchange Disclaimer
|
||||
public static int AddExchangeDisclaimer(int itemID, ExchangeDisclaimer disclaimer)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@ExchangeDisclaimerId", SqlDbType.Int);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddExchangeDisclaimer",
|
||||
outParam,
|
||||
|
||||
new SqlParameter("@ItemID", itemID),
|
||||
new SqlParameter("@DisclaimerName", disclaimer.DisclaimerName),
|
||||
new SqlParameter("@DisclaimerText", disclaimer.DisclaimerText)
|
||||
);
|
||||
|
||||
return Convert.ToInt32(outParam.Value);
|
||||
}
|
||||
|
||||
public static void UpdateExchangeDisclaimer(int itemID, ExchangeDisclaimer disclaimer)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"UpdateExchangeDisclaimer",
|
||||
new SqlParameter("@ExchangeDisclaimerId", disclaimer.ExchangeDisclaimerId),
|
||||
new SqlParameter("@DisclaimerName", disclaimer.DisclaimerName),
|
||||
new SqlParameter("@DisclaimerText", disclaimer.DisclaimerText)
|
||||
);
|
||||
}
|
||||
|
||||
public static void DeleteExchangeDisclaimer(int exchangeDisclaimerId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteExchangeDisclaimer",
|
||||
new SqlParameter("@ExchangeDisclaimerId", exchangeDisclaimerId)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetExchangeDisclaimer(int exchangeDisclaimerId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeDisclaimer",
|
||||
new SqlParameter("@ExchangeDisclaimerId", exchangeDisclaimerId)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetExchangeDisclaimers(int itemId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeDisclaimers",
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
);
|
||||
}
|
||||
|
||||
public static void SetExchangeAccountDisclaimerId(int AccountID, int ExchangeDisclaimerId)
|
||||
{
|
||||
object id = null;
|
||||
if (ExchangeDisclaimerId != -1) id = ExchangeDisclaimerId;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"SetExchangeAccountDisclaimerId",
|
||||
new SqlParameter("@AccountID", AccountID),
|
||||
new SqlParameter("@ExchangeDisclaimerId", id)
|
||||
);
|
||||
}
|
||||
|
||||
public static int GetExchangeAccountDisclaimerId(int AccountID)
|
||||
{
|
||||
object objReturn = SqlHelper.ExecuteScalar(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetExchangeAccountDisclaimerId",
|
||||
new SqlParameter("@AccountID", AccountID)
|
||||
);
|
||||
|
||||
int ret;
|
||||
if (!int.TryParse(objReturn.ToString(), out ret)) return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Organizations
|
||||
|
||||
public static void DeleteOrganizationUser(int itemId)
|
||||
|
|
|
@ -4956,5 +4956,194 @@ namespace WebsitePanel.EnterpriseServer
|
|||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
public static int AddExchangeDisclaimer(int itemID, ExchangeDisclaimer disclaimer)
|
||||
{
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("EXCHANGE", "ADD_EXCHANGE_EXCHANGEDISCLAIMER");
|
||||
TaskManager.ItemId = itemID;
|
||||
|
||||
try
|
||||
{
|
||||
return DataProvider.AddExchangeDisclaimer(itemID, disclaimer);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static int UpdateExchangeDisclaimer(int itemID, ExchangeDisclaimer disclaimer)
|
||||
{
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("EXCHANGE", "UPDATE_EXCHANGE_EXCHANGEDISCLAIMER");
|
||||
TaskManager.ItemId = itemID;
|
||||
|
||||
try
|
||||
{
|
||||
DataProvider.UpdateExchangeDisclaimer(itemID, disclaimer);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int DeleteExchangeDisclaimer(int itemId, int exchangeDisclaimerId)
|
||||
{
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
TaskManager.StartTask("EXCHANGE", "DELETE_EXCHANGE_EXCHANGEDISCLAIMER");
|
||||
TaskManager.ItemId = itemId;
|
||||
|
||||
try
|
||||
{
|
||||
DataProvider.DeleteExchangeDisclaimer(exchangeDisclaimerId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static ExchangeDisclaimer GetExchangeDisclaimer(int itemId, int exchangeDisclaimerId)
|
||||
{
|
||||
|
||||
TaskManager.StartTask("EXCHANGE", "GET_EXCHANGE_EXCHANGEDISCLAIMER");
|
||||
TaskManager.ItemId = itemId;
|
||||
|
||||
try
|
||||
{
|
||||
return ObjectUtils.FillObjectFromDataReader<ExchangeDisclaimer>(
|
||||
DataProvider.GetExchangeDisclaimer(exchangeDisclaimerId));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static List<ExchangeDisclaimer> GetExchangeDisclaimers(int itemId)
|
||||
{
|
||||
TaskManager.StartTask("EXCHANGE", "GET_EXCHANGE_EXCHANGEDISCLAIMER");
|
||||
TaskManager.ItemId = itemId;
|
||||
|
||||
try
|
||||
{
|
||||
List<ExchangeDisclaimer> disclaimers = ObjectUtils.CreateListFromDataReader<ExchangeDisclaimer>(DataProvider.GetExchangeDisclaimers(itemId));
|
||||
return disclaimers;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int SetExchangeAccountDisclaimerId(int itemId, int AccountID, int ExchangeDisclaimerId)
|
||||
{
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("EXCHANGE", "SET_EXCHANGE_ACCOUNTDISCLAIMERID");
|
||||
TaskManager.ItemId = AccountID;
|
||||
|
||||
try
|
||||
{
|
||||
ExchangeDisclaimer disclaimer = null;
|
||||
|
||||
if (ExchangeDisclaimerId != -1)
|
||||
disclaimer = GetExchangeDisclaimer(itemId, ExchangeDisclaimerId);
|
||||
|
||||
// load account
|
||||
ExchangeAccount account = GetAccount(itemId, AccountID);
|
||||
|
||||
Organization org = (Organization)PackageController.GetPackageItem(itemId);
|
||||
if (org == null)
|
||||
return -1;
|
||||
|
||||
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
|
||||
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
|
||||
|
||||
string transportRuleName = org.Name + "_" + account.PrimaryEmailAddress;
|
||||
|
||||
exchange.RemoveTransportRule(transportRuleName);
|
||||
|
||||
if (disclaimer != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(disclaimer.DisclaimerText))
|
||||
exchange.NewDisclaimerTransportRule(transportRuleName, account.PrimaryEmailAddress, disclaimer.DisclaimerText);
|
||||
}
|
||||
|
||||
DataProvider.SetExchangeAccountDisclaimerId(AccountID, ExchangeDisclaimerId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public static int GetExchangeAccountDisclaimerId(int itemId, int AccountID)
|
||||
{
|
||||
TaskManager.StartTask("EXCHANGE", "GET_EXCHANGE_ACCOUNTDISCLAIMERID");
|
||||
TaskManager.ItemId = AccountID;
|
||||
|
||||
try
|
||||
{
|
||||
return DataProvider.GetExchangeAccountDisclaimerId(AccountID);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,15 +37,15 @@ using Microsoft.Web.Services3;
|
|||
|
||||
namespace WebsitePanel.EnterpriseServer
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for esApplicationsInstaller
|
||||
/// </summary>
|
||||
[WebService(Namespace = "http://smbsaas/websitepanel/enterpriseserver")]
|
||||
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
||||
[Policy("ServerPolicy")]
|
||||
[ToolboxItem(false)]
|
||||
public class esExchangeServer : WebService
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for esApplicationsInstaller
|
||||
/// </summary>
|
||||
[WebService(Namespace = "http://smbsaas/websitepanel/enterpriseserver")]
|
||||
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
||||
[Policy("ServerPolicy")]
|
||||
[ToolboxItem(false)]
|
||||
public class esExchangeServer : WebService
|
||||
{
|
||||
#region Organizations
|
||||
[WebMethod]
|
||||
public DataSet GetRawExchangeOrganizationsPaged(int packageId, bool recursive,
|
||||
|
@ -86,7 +86,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
return ExchangeServerController.GetOrganizationStatisticsByOrganization(itemId);
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public int DeleteOrganization(int itemId)
|
||||
{
|
||||
|
@ -547,94 +547,138 @@ namespace WebsitePanel.EnterpriseServer
|
|||
#endregion
|
||||
|
||||
|
||||
#region Public Folders
|
||||
[WebMethod]
|
||||
public int CreatePublicFolder(int itemId, string parentFolder, string folderName,
|
||||
bool mailEnabled, string accountName, string domain)
|
||||
{
|
||||
return ExchangeServerController.CreatePublicFolder(itemId, parentFolder, folderName,
|
||||
mailEnabled, accountName, domain);
|
||||
}
|
||||
#region Public Folders
|
||||
[WebMethod]
|
||||
public int CreatePublicFolder(int itemId, string parentFolder, string folderName,
|
||||
bool mailEnabled, string accountName, string domain)
|
||||
{
|
||||
return ExchangeServerController.CreatePublicFolder(itemId, parentFolder, folderName,
|
||||
mailEnabled, accountName, domain);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int DeletePublicFolders(int itemId, int[] accountIds)
|
||||
{
|
||||
return ExchangeServerController.DeletePublicFolders(itemId, accountIds);
|
||||
}
|
||||
[WebMethod]
|
||||
public int DeletePublicFolders(int itemId, int[] accountIds)
|
||||
{
|
||||
return ExchangeServerController.DeletePublicFolders(itemId, accountIds);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int DeletePublicFolder(int itemId, int accountId)
|
||||
{
|
||||
return ExchangeServerController.DeletePublicFolder(itemId, accountId);
|
||||
}
|
||||
[WebMethod]
|
||||
public int DeletePublicFolder(int itemId, int accountId)
|
||||
{
|
||||
return ExchangeServerController.DeletePublicFolder(itemId, accountId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int EnableMailPublicFolder(int itemId, int accountId,
|
||||
string name, string domain)
|
||||
{
|
||||
return ExchangeServerController.EnableMailPublicFolder(itemId, accountId, name, domain);
|
||||
}
|
||||
[WebMethod]
|
||||
public int EnableMailPublicFolder(int itemId, int accountId,
|
||||
string name, string domain)
|
||||
{
|
||||
return ExchangeServerController.EnableMailPublicFolder(itemId, accountId, name, domain);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int DisableMailPublicFolder(int itemId, int accountId)
|
||||
{
|
||||
return ExchangeServerController.DisableMailPublicFolder(itemId, accountId);
|
||||
}
|
||||
[WebMethod]
|
||||
public int DisableMailPublicFolder(int itemId, int accountId)
|
||||
{
|
||||
return ExchangeServerController.DisableMailPublicFolder(itemId, accountId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ExchangePublicFolder GetPublicFolderGeneralSettings(int itemId, int accountId)
|
||||
{
|
||||
return ExchangeServerController.GetPublicFolderGeneralSettings(itemId, accountId);
|
||||
}
|
||||
[WebMethod]
|
||||
public ExchangePublicFolder GetPublicFolderGeneralSettings(int itemId, int accountId)
|
||||
{
|
||||
return ExchangeServerController.GetPublicFolderGeneralSettings(itemId, accountId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int SetPublicFolderGeneralSettings(int itemId, int accountId, string newName,
|
||||
bool hideAddressBook, ExchangeAccount[] accounts)
|
||||
{
|
||||
return ExchangeServerController.SetPublicFolderGeneralSettings(itemId, accountId, newName,
|
||||
hideAddressBook, accounts);
|
||||
}
|
||||
[WebMethod]
|
||||
public int SetPublicFolderGeneralSettings(int itemId, int accountId, string newName,
|
||||
bool hideAddressBook, ExchangeAccount[] accounts)
|
||||
{
|
||||
return ExchangeServerController.SetPublicFolderGeneralSettings(itemId, accountId, newName,
|
||||
hideAddressBook, accounts);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ExchangePublicFolder GetPublicFolderMailFlowSettings(int itemId, int accountId)
|
||||
{
|
||||
return ExchangeServerController.GetPublicFolderMailFlowSettings(itemId, accountId);
|
||||
}
|
||||
[WebMethod]
|
||||
public ExchangePublicFolder GetPublicFolderMailFlowSettings(int itemId, int accountId)
|
||||
{
|
||||
return ExchangeServerController.GetPublicFolderMailFlowSettings(itemId, accountId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int SetPublicFolderMailFlowSettings(int itemId, int accountId,
|
||||
string[] acceptAccounts, string[] rejectAccounts, bool requireSenderAuthentication)
|
||||
{
|
||||
return ExchangeServerController.SetPublicFolderMailFlowSettings(itemId, accountId,
|
||||
acceptAccounts, rejectAccounts, requireSenderAuthentication);
|
||||
}
|
||||
[WebMethod]
|
||||
public int SetPublicFolderMailFlowSettings(int itemId, int accountId,
|
||||
string[] acceptAccounts, string[] rejectAccounts, bool requireSenderAuthentication)
|
||||
{
|
||||
return ExchangeServerController.SetPublicFolderMailFlowSettings(itemId, accountId,
|
||||
acceptAccounts, rejectAccounts, requireSenderAuthentication);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ExchangeEmailAddress[] GetPublicFolderEmailAddresses(int itemId, int accountId)
|
||||
{
|
||||
return ExchangeServerController.GetPublicFolderEmailAddresses(itemId, accountId);
|
||||
}
|
||||
[WebMethod]
|
||||
public ExchangeEmailAddress[] GetPublicFolderEmailAddresses(int itemId, int accountId)
|
||||
{
|
||||
return ExchangeServerController.GetPublicFolderEmailAddresses(itemId, accountId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int AddPublicFolderEmailAddress(int itemId, int accountId, string emailAddress)
|
||||
{
|
||||
return ExchangeServerController.AddPublicFolderEmailAddress(itemId, accountId, emailAddress);
|
||||
}
|
||||
[WebMethod]
|
||||
public int AddPublicFolderEmailAddress(int itemId, int accountId, string emailAddress)
|
||||
{
|
||||
return ExchangeServerController.AddPublicFolderEmailAddress(itemId, accountId, emailAddress);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int SetPublicFolderPrimaryEmailAddress(int itemId, int accountId, string emailAddress)
|
||||
{
|
||||
return ExchangeServerController.SetPublicFolderPrimaryEmailAddress(itemId, accountId, emailAddress);
|
||||
}
|
||||
[WebMethod]
|
||||
public int SetPublicFolderPrimaryEmailAddress(int itemId, int accountId, string emailAddress)
|
||||
{
|
||||
return ExchangeServerController.SetPublicFolderPrimaryEmailAddress(itemId, accountId, emailAddress);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int DeletePublicFolderEmailAddresses(int itemId, int accountId, string[] emailAddresses)
|
||||
{
|
||||
return ExchangeServerController.DeletePublicFolderEmailAddresses(itemId, accountId, emailAddresses);
|
||||
}
|
||||
#endregion
|
||||
[WebMethod]
|
||||
public int DeletePublicFolderEmailAddresses(int itemId, int accountId, string[] emailAddresses)
|
||||
{
|
||||
return ExchangeServerController.DeletePublicFolderEmailAddresses(itemId, accountId, emailAddresses);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Disclaimers
|
||||
|
||||
[WebMethod]
|
||||
public int AddExchangeDisclaimer(int itemId, ExchangeDisclaimer disclaimer)
|
||||
{
|
||||
return ExchangeServerController.AddExchangeDisclaimer(itemId, disclaimer);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int UpdateExchangeDisclaimer(int itemId, ExchangeDisclaimer disclaimer)
|
||||
{
|
||||
return ExchangeServerController.UpdateExchangeDisclaimer(itemId, disclaimer);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int DeleteExchangeDisclaimer(int itemId, int exchangeDisclaimerId)
|
||||
{
|
||||
return ExchangeServerController.DeleteExchangeDisclaimer(itemId, exchangeDisclaimerId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ExchangeDisclaimer GetExchangeDisclaimer(int itemId, int exchangeDisclaimerId)
|
||||
{
|
||||
return ExchangeServerController.GetExchangeDisclaimer(itemId, exchangeDisclaimerId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<ExchangeDisclaimer> GetExchangeDisclaimers(int itemId)
|
||||
{
|
||||
return ExchangeServerController.GetExchangeDisclaimers(itemId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int SetExchangeAccountDisclaimerId(int itemId, int AccountID, int ExchangeDisclaimerId)
|
||||
{
|
||||
return ExchangeServerController.SetExchangeAccountDisclaimerId(itemId, AccountID, ExchangeDisclaimerId);
|
||||
}
|
||||
[WebMethod]
|
||||
|
||||
public int GetExchangeAccountDisclaimerId(int itemId, int AccountID)
|
||||
{
|
||||
return ExchangeServerController.GetExchangeAccountDisclaimerId(itemId, AccountID);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue