2019-06-14 16:14:24 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* (c) Copyright Ascensio System Limited 2010-2018
|
|
|
|
*
|
|
|
|
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
|
|
|
|
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
|
|
|
|
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
|
|
|
|
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
|
|
|
|
*
|
|
|
|
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
|
|
|
|
*
|
|
|
|
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
|
|
|
|
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
|
|
|
|
*
|
|
|
|
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
|
|
|
|
* relevant author attributions when distributing the software. If the display of the logo in its graphic
|
|
|
|
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
|
|
|
|
* in every copy of the program you distribute.
|
|
|
|
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2020-02-17 08:58:14 +00:00
|
|
|
using ASC.Common;
|
2019-09-09 12:56:33 +00:00
|
|
|
using ASC.Core;
|
2019-06-14 16:14:24 +00:00
|
|
|
using ASC.Core.Notify;
|
|
|
|
using ASC.Notify.Model;
|
|
|
|
using ASC.Notify.Patterns;
|
|
|
|
using ASC.Notify.Recipients;
|
|
|
|
using ASC.Web.Core.PublicResources;
|
|
|
|
|
|
|
|
namespace ASC.Web.Studio.Core.Notify
|
|
|
|
{
|
2020-10-19 15:53:15 +00:00
|
|
|
[Scope]
|
2019-09-09 12:56:33 +00:00
|
|
|
public class StudioNotifySource : NotifySource
|
2019-06-14 16:14:24 +00:00
|
|
|
{
|
2019-09-19 13:43:28 +00:00
|
|
|
public StudioNotifySource(UserManager userManager, IRecipientProvider recipientsProvider, SubscriptionManager subscriptionManager)
|
|
|
|
: base("asc.web.studio", userManager, recipientsProvider, subscriptionManager)
|
2019-06-14 16:14:24 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override IActionProvider CreateActionProvider()
|
|
|
|
{
|
|
|
|
return new ConstActionProvider(
|
|
|
|
Actions.SelfProfileUpdated,
|
|
|
|
Actions.JoinUsers,
|
|
|
|
Actions.SendWhatsNew,
|
|
|
|
Actions.UserHasJoin,
|
|
|
|
Actions.BackupCreated,
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.RestoreStarted,
|
|
|
|
Actions.RestoreCompletedV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
Actions.PortalDeactivate,
|
|
|
|
Actions.PortalDelete,
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.PortalDeleteSuccessV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
Actions.DnsChange,
|
|
|
|
Actions.ConfirmOwnerChange,
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.EmailChangeV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
Actions.PasswordChange,
|
|
|
|
Actions.ActivateEmail,
|
|
|
|
Actions.ProfileDelete,
|
2020-01-23 08:52:07 +00:00
|
|
|
Actions.ProfileHasDeletedItself,
|
2019-06-14 16:14:24 +00:00
|
|
|
Actions.ReassignsCompleted,
|
|
|
|
Actions.ReassignsFailed,
|
|
|
|
Actions.RemoveUserDataCompleted,
|
|
|
|
Actions.RemoveUserDataCompletedCustomMode,
|
|
|
|
Actions.RemoveUserDataFailed,
|
|
|
|
Actions.PhoneChange,
|
|
|
|
Actions.MigrationPortalStart,
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.MigrationPortalSuccessV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
Actions.MigrationPortalError,
|
|
|
|
Actions.MigrationPortalServerFailure,
|
|
|
|
|
|
|
|
Actions.UserMessageToAdmin,
|
|
|
|
|
|
|
|
Actions.VoipWarning,
|
|
|
|
Actions.VoipBlocked,
|
|
|
|
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.SaasAdminActivationV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
Actions.EnterpriseAdminActivationV10,
|
|
|
|
Actions.EnterpriseWhitelabelAdminActivationV10,
|
2020-09-18 14:45:59 +00:00
|
|
|
Actions.OpensourceAdminActivationV11,
|
2019-06-14 16:14:24 +00:00
|
|
|
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.SaasAdminWelcomeV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
Actions.EnterpriseAdminWelcomeV10,
|
|
|
|
Actions.EnterpriseWhitelabelAdminWelcomeV10,
|
2020-09-18 14:45:59 +00:00
|
|
|
Actions.OpensourceAdminWelcomeV11,
|
2019-06-14 16:14:24 +00:00
|
|
|
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.SaasUserActivationV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
Actions.EnterpriseUserActivationV10,
|
|
|
|
Actions.EnterpriseWhitelabelUserActivationV10,
|
2020-09-18 14:45:59 +00:00
|
|
|
Actions.OpensourceUserActivationV11,
|
2019-06-14 16:14:24 +00:00
|
|
|
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.SaasUserWelcomeV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
Actions.EnterpriseUserWelcomeV10,
|
|
|
|
Actions.EnterpriseWhitelabelUserWelcomeV10,
|
|
|
|
Actions.EnterpriseWhitelabelUserWelcomeCustomMode,
|
2020-09-18 14:45:59 +00:00
|
|
|
Actions.OpensourceUserWelcomeV11,
|
2019-06-14 16:14:24 +00:00
|
|
|
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.SaasGuestActivationV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
Actions.EnterpriseGuestActivationV10,
|
|
|
|
Actions.EnterpriseWhitelabelGuestActivationV10,
|
2020-09-18 14:45:59 +00:00
|
|
|
Actions.OpensourceGuestActivationV11,
|
2019-06-14 16:14:24 +00:00
|
|
|
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.SaasGuestWelcomeV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
Actions.EnterpriseGuestWelcomeV10,
|
|
|
|
Actions.EnterpriseWhitelabelGuestWelcomeV10,
|
2020-09-18 14:45:59 +00:00
|
|
|
Actions.OpensourceGuestWelcomeV11,
|
2019-06-14 16:14:24 +00:00
|
|
|
|
|
|
|
Actions.EnterpriseAdminCustomizePortalV10,
|
|
|
|
Actions.EnterpriseWhitelabelAdminCustomizePortalV10,
|
|
|
|
Actions.EnterpriseAdminInviteTeammatesV10,
|
|
|
|
Actions.EnterpriseAdminWithoutActivityV10,
|
|
|
|
Actions.EnterpriseAdminUserDocsTipsV10,
|
|
|
|
Actions.EnterpriseAdminUserAppsTipsV10,
|
|
|
|
|
|
|
|
Actions.EnterpriseAdminTrialWarningBefore7V10,
|
|
|
|
Actions.EnterpriseAdminTrialWarningV10,
|
|
|
|
|
|
|
|
Actions.EnterpriseAdminPaymentWarningBefore7V10,
|
|
|
|
Actions.EnterpriseWhitelabelAdminPaymentWarningBefore7V10,
|
|
|
|
Actions.EnterpriseAdminPaymentWarningV10,
|
|
|
|
Actions.EnterpriseWhitelabelAdminPaymentWarningV10,
|
|
|
|
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.SaasAdminUserDocsTipsV115,
|
|
|
|
Actions.SaasAdminComfortTipsV115,
|
|
|
|
Actions.SaasAdminUserAppsTipsV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.SaasAdminTrialWarningBefore5V115,
|
|
|
|
Actions.SaasAdminTrialWarningV115,
|
|
|
|
Actions.SaasAdminTrialWarningAfter1V115,
|
|
|
|
Actions.SaasAdminTrialWarningAfterHalfYearV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.SaasAdminPaymentWarningEvery2MonthsV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.SaasAdminModulesV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
|
2020-09-18 14:45:59 +00:00
|
|
|
Actions.OpensourceAdminDocsTipsV11,
|
|
|
|
Actions.OpensourceUserDocsTipsV11,
|
2019-06-14 16:14:24 +00:00
|
|
|
|
|
|
|
Actions.PersonalActivate,
|
|
|
|
Actions.PersonalAfterRegistration1,
|
|
|
|
Actions.PersonalAfterRegistration7,
|
|
|
|
Actions.PersonalAfterRegistration14,
|
|
|
|
Actions.PersonalAfterRegistration21,
|
|
|
|
Actions.PersonalAfterRegistration28,
|
|
|
|
Actions.PersonalConfirmation,
|
|
|
|
Actions.PersonalPasswordChange,
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.PersonalEmailChangeV115,
|
2019-06-14 16:14:24 +00:00
|
|
|
Actions.PersonalProfileDelete,
|
|
|
|
|
|
|
|
Actions.MailboxCreated,
|
|
|
|
Actions.MailboxWithoutSettingsCreated,
|
|
|
|
|
|
|
|
Actions.MailboxCreated,
|
|
|
|
Actions.MailboxWithoutSettingsCreated,
|
|
|
|
|
|
|
|
Actions.PersonalCustomModeAfterRegistration1,
|
|
|
|
Actions.PersonalCustomModeAfterRegistration7,
|
|
|
|
Actions.PersonalCustomModeConfirmation,
|
|
|
|
Actions.PersonalCustomModePasswordChange,
|
2021-05-24 17:41:31 +00:00
|
|
|
Actions.PersonalCustomModeEmailChangeV115,
|
2020-09-11 14:12:35 +00:00
|
|
|
Actions.PersonalCustomModeProfileDelete,
|
|
|
|
|
2020-09-18 14:45:59 +00:00
|
|
|
Actions.SaasCustomModeRegData,
|
|
|
|
|
|
|
|
Actions.StorageEncryptionStart,
|
|
|
|
Actions.StorageEncryptionSuccess,
|
|
|
|
Actions.StorageEncryptionError,
|
|
|
|
Actions.StorageDecryptionStart,
|
|
|
|
Actions.StorageDecryptionSuccess,
|
|
|
|
Actions.StorageDecryptionError
|
2019-06-14 16:14:24 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override IPatternProvider CreatePatternsProvider()
|
|
|
|
{
|
|
|
|
return new XmlPatternProvider2(WebPatternResource.webstudio_patterns);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override ISubscriptionProvider CreateSubscriptionProvider()
|
|
|
|
{
|
|
|
|
return new AdminNotifySubscriptionProvider(base.CreateSubscriptionProvider());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private class AdminNotifySubscriptionProvider : ISubscriptionProvider
|
|
|
|
{
|
|
|
|
private readonly ISubscriptionProvider provider;
|
|
|
|
|
|
|
|
|
|
|
|
public AdminNotifySubscriptionProvider(ISubscriptionProvider provider)
|
|
|
|
{
|
|
|
|
this.provider = provider;
|
|
|
|
}
|
|
|
|
|
2019-09-12 11:34:58 +00:00
|
|
|
public object GetSubscriptionRecord(INotifyAction action, IRecipient recipient, string objectID)
|
2019-06-14 16:14:24 +00:00
|
|
|
{
|
2019-09-12 11:34:58 +00:00
|
|
|
return provider.GetSubscriptionRecord(GetAdminAction(action), recipient, objectID);
|
2019-06-14 16:14:24 +00:00
|
|
|
}
|
|
|
|
|
2019-09-12 11:34:58 +00:00
|
|
|
public string[] GetSubscriptions(INotifyAction action, IRecipient recipient, bool checkSubscription = true)
|
2019-06-14 16:14:24 +00:00
|
|
|
{
|
2019-09-12 11:34:58 +00:00
|
|
|
return provider.GetSubscriptions(GetAdminAction(action), recipient, checkSubscription);
|
2019-06-14 16:14:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Subscribe(INotifyAction action, string objectID, IRecipient recipient)
|
|
|
|
{
|
|
|
|
provider.Subscribe(GetAdminAction(action), objectID, recipient);
|
|
|
|
}
|
|
|
|
|
2019-09-12 11:34:58 +00:00
|
|
|
public void UnSubscribe(INotifyAction action, IRecipient recipient)
|
2019-06-14 16:14:24 +00:00
|
|
|
{
|
2019-09-12 11:34:58 +00:00
|
|
|
provider.UnSubscribe(GetAdminAction(action), recipient);
|
2019-06-14 16:14:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void UnSubscribe(INotifyAction action)
|
|
|
|
{
|
|
|
|
provider.UnSubscribe(GetAdminAction(action));
|
|
|
|
}
|
|
|
|
|
|
|
|
public void UnSubscribe(INotifyAction action, string objectID)
|
|
|
|
{
|
|
|
|
provider.UnSubscribe(GetAdminAction(action), objectID);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void UnSubscribe(INotifyAction action, string objectID, IRecipient recipient)
|
|
|
|
{
|
|
|
|
provider.UnSubscribe(GetAdminAction(action), objectID, recipient);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void UpdateSubscriptionMethod(INotifyAction action, IRecipient recipient, params string[] senderNames)
|
|
|
|
{
|
|
|
|
provider.UpdateSubscriptionMethod(GetAdminAction(action), recipient, senderNames);
|
|
|
|
}
|
|
|
|
|
2019-09-12 11:34:58 +00:00
|
|
|
public IRecipient[] GetRecipients(INotifyAction action, string objectID)
|
2019-06-14 16:14:24 +00:00
|
|
|
{
|
2019-09-12 11:34:58 +00:00
|
|
|
return provider.GetRecipients(GetAdminAction(action), objectID);
|
2019-06-14 16:14:24 +00:00
|
|
|
}
|
|
|
|
|
2019-09-12 11:34:58 +00:00
|
|
|
public string[] GetSubscriptionMethod(INotifyAction action, IRecipient recipient)
|
2019-06-14 16:14:24 +00:00
|
|
|
{
|
2019-09-12 11:34:58 +00:00
|
|
|
return provider.GetSubscriptionMethod(GetAdminAction(action), recipient);
|
2019-06-14 16:14:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsUnsubscribe(IDirectRecipient recipient, INotifyAction action, string objectID)
|
|
|
|
{
|
|
|
|
return provider.IsUnsubscribe(recipient, action, objectID);
|
|
|
|
}
|
|
|
|
|
|
|
|
private INotifyAction GetAdminAction(INotifyAction action)
|
|
|
|
{
|
|
|
|
if (Actions.SelfProfileUpdated.ID == action.ID ||
|
|
|
|
Actions.UserHasJoin.ID == action.ID ||
|
|
|
|
Actions.UserMessageToAdmin.ID == action.ID ||
|
|
|
|
Actions.VoipWarning.ID == action.ID ||
|
|
|
|
Actions.VoipBlocked.ID == action.ID
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return Actions.AdminNotify;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|