Exemplo n.º 1
0
 public void Deconstruct(out TenantManager tenantManager,
                         out PaymentManager paymentManager,
                         out TenantUtil tenantUtil,
                         out StudioNotifyHelper studioNotifyHelper,
                         out UserManager userManager,
                         out SecurityContext securityContext,
                         out AuthContext authContext,
                         out AuthManager authManager,
                         out CommonLinkUtility commonLinkUtility,
                         out DisplayUserSettingsHelper displayUserSettingsHelper,
                         out FeedAggregateDataProvider feedAggregateDataProvider,
                         out CoreSettings coreSettings)
 {
     tenantManager             = TenantManager;
     paymentManager            = PaymentManager;
     tenantUtil                = TenantUtil;
     studioNotifyHelper        = StudioNotifyHelper;
     userManager               = UserManager;
     securityContext           = SecurityContext;
     authContext               = AuthContext;
     authManager               = AuthManager;
     commonLinkUtility         = CommonLinkUtility;
     displayUserSettingsHelper = DisplayUserSettingsHelper;
     feedAggregateDataProvider = FeedAggregateDataProvider;
     coreSettings              = CoreSettings;
 }
Exemplo n.º 2
0
 public NotifyConfigurationScope(TenantManager tenantManager,
                                 WebItemSecurity webItemSecurity,
                                 UserManager userManager,
                                 IOptionsMonitor <ILog> options,
                                 TenantExtra tenantExtra,
                                 WebItemManagerSecurity webItemManagerSecurity,
                                 WebItemManager webItemManager,
                                 IConfiguration configuration,
                                 TenantLogoManager tenantLogoManager,
                                 AdditionalWhiteLabelSettingsHelper additionalWhiteLabelSettingsHelper,
                                 TenantUtil tenantUtil,
                                 CoreBaseSettings coreBaseSettings,
                                 CommonLinkUtility commonLinkUtility,
                                 SettingsManager settingsManager,
                                 StudioNotifyHelper studioNotifyHelper
                                 )
 {
     TenantManager                      = tenantManager;
     WebItemSecurity                    = webItemSecurity;
     UserManager                        = userManager;
     Options                            = options;
     TenantExtra                        = tenantExtra;
     WebItemManagerSecurity             = webItemManagerSecurity;
     WebItemManager                     = webItemManager;
     Configuration                      = configuration;
     TenantLogoManager                  = tenantLogoManager;
     AdditionalWhiteLabelSettingsHelper = additionalWhiteLabelSettingsHelper;
     TenantUtil                         = tenantUtil;
     CoreBaseSettings                   = coreBaseSettings;
     CommonLinkUtility                  = commonLinkUtility;
     SettingsManager                    = settingsManager;
     StudioNotifyHelper                 = studioNotifyHelper;
 }
Exemplo n.º 3
0
 public StudioNotifyService(
     UserManager userManager,
     StudioNotifyHelper studioNotifyHelper,
     StudioNotifyServiceHelper studioNotifyServiceHelper,
     TenantExtra tenantExtra,
     AuthManager authentication,
     AuthContext authContext,
     IConfiguration configuration,
     TenantManager tenantManager,
     CoreBaseSettings coreBaseSettings,
     CommonLinkUtility commonLinkUtility,
     SetupInfo setupInfo,
     IServiceProvider serviceProvider,
     DisplayUserSettingsHelper displayUserSettingsHelper,
     SettingsManager settingsManager,
     WebItemSecurity webItemSecurity,
     IOptionsMonitor <ILog> option)
 {
     Log                       = option.Get("ASC.Notify");
     client                    = studioNotifyServiceHelper;
     TenantExtra               = tenantExtra;
     Authentication            = authentication;
     AuthContext               = authContext;
     Configuration             = configuration;
     TenantManager             = tenantManager;
     CoreBaseSettings          = coreBaseSettings;
     CommonLinkUtility         = commonLinkUtility;
     SetupInfo                 = setupInfo;
     ServiceProvider           = serviceProvider;
     DisplayUserSettingsHelper = displayUserSettingsHelper;
     SettingsManager           = settingsManager;
     WebItemSecurity           = webItemSecurity;
     UserManager               = userManager;
     StudioNotifyHelper        = studioNotifyHelper;
 }
        public void SendMailboxCreated(List <string> toEmails, string username, string address, string server,
                                       string encyption, int portImap, int portSmtp, string login, bool skipSettings = false)
        {
            var tags = new List <ITagValue>
            {
                new TagValue(Tags.UserName, username ?? string.Empty),
                new TagValue(Tags.Address, address ?? string.Empty)
            };

            if (!skipSettings)
            {
                var link = string.Format("{0}/addons/mail/#accounts/changepwd={1}",
                                         CommonLinkUtility.GetFullAbsolutePath("~").TrimEnd('/'), address);

                tags.Add(new TagValue(Tags.MyStaffLink, link));
                tags.Add(new TagValue(Tags.Server, server));
                tags.Add(new TagValue(Tags.Encryption, encyption ?? string.Empty));
                tags.Add(new TagValue(Tags.ImapPort, portImap.ToString(CultureInfo.InvariantCulture)));
                tags.Add(new TagValue(Tags.SmtpPort, portSmtp.ToString(CultureInfo.InvariantCulture)));
                tags.Add(new TagValue(Tags.Login, login));
            }

            client.SendNoticeToAsync(
                skipSettings
                    ? Actions.MailboxWithoutSettingsCreated
                    : Actions.MailboxCreated,
                null,
                StudioNotifyHelper.RecipientFromEmail(toEmails, false),
                new[] { EMailSenderName },
                null,
                tags.ToArray());
        }
        public void PortalRenameNotify(String oldVirtualRootPath)
        {
            var tenant = CoreContext.TenantManager.GetCurrentTenant();

            var users = CoreContext.UserManager.GetUsers()
                        .Where(u => u.ActivationStatus.HasFlag(EmployeeActivationStatus.Activated));

            ThreadPool.QueueUserWorkItem(_ =>
            {
                try
                {
                    CoreContext.TenantManager.SetCurrentTenant(tenant);

                    foreach (var u in users)
                    {
                        var culture = string.IsNullOrEmpty(u.CultureName) ? tenant.GetCulture() : u.GetCulture();
                        Thread.CurrentThread.CurrentCulture   = culture;
                        Thread.CurrentThread.CurrentUICulture = culture;

                        client.SendNoticeToAsync(
                            Actions.PortalRename,
                            null,
                            new[] { StudioNotifyHelper.ToRecipient(u.ID) },
                            new[] { EMailSenderName },
                            null,
                            new TagValue(Tags.PortalUrl, oldVirtualRootPath),
                            new TagValue(Tags.UserDisplayName, u.DisplayUserName()));
                    }
                }
                catch (Exception ex)
                {
                    LogManager.GetLogger("ASC.Notify").Error(ex);
                }
            });
        }
        public void SendInvitePersonal(string email, string additionalMember = "")
        {
            var newUserInfo = CoreContext.UserManager.GetUserByEmail(email);

            if (CoreContext.UserManager.UserExists(newUserInfo.ID))
            {
                return;
            }

            var lang = CoreContext.Configuration.CustomMode
                           ? "ru-RU"
                           : Thread.CurrentThread.CurrentUICulture.Name;

            var culture = SetupInfo.GetPersonalCulture(lang);

            var confirmUrl = CommonLinkUtility.GetConfirmationUrl(email, ConfirmType.EmpInvite, (int)EmployeeType.User)
                             + "&emplType=" + (int)EmployeeType.User
                             + "&lang=" + culture.Key
                             + additionalMember;

            client.SendNoticeToAsync(
                CoreContext.Configuration.CustomMode ? Actions.PersonalCustomModeConfirmation : Actions.PersonalConfirmation,
                null,
                StudioNotifyHelper.RecipientFromEmail(email, false),
                new[] { EMailSenderName },
                null,
                new TagValue(Tags.InviteLink, confirmUrl),
                new TagValue(CommonTags.Footer, CoreContext.Configuration.CustomMode ? "personalCustomMode" : "personal"),
                new TagValue(CommonTags.Culture, Thread.CurrentThread.CurrentUICulture.Name));
        }
Exemplo n.º 7
0
 public StudioWhatsNewNotifyScope(TenantManager tenantManager,
                                  PaymentManager paymentManager,
                                  TenantUtil tenantUtil,
                                  StudioNotifyHelper studioNotifyHelper,
                                  UserManager userManager,
                                  SecurityContext securityContext,
                                  AuthContext authContext,
                                  AuthManager authManager,
                                  CommonLinkUtility commonLinkUtility,
                                  DisplayUserSettingsHelper displayUserSettingsHelper,
                                  FeedAggregateDataProvider feedAggregateDataProvider,
                                  CoreSettings coreSettings)
 {
     TenantManager             = tenantManager;
     PaymentManager            = paymentManager;
     TenantUtil                = tenantUtil;
     StudioNotifyHelper        = studioNotifyHelper;
     UserManager               = userManager;
     SecurityContext           = securityContext;
     AuthContext               = authContext;
     AuthManager               = authManager;
     CommonLinkUtility         = commonLinkUtility;
     DisplayUserSettingsHelper = displayUserSettingsHelper;
     FeedAggregateDataProvider = feedAggregateDataProvider;
     CoreSettings              = coreSettings;
 }
Exemplo n.º 8
0
 public void Deconstruct(out TenantManager tenantManager,
                         out WebItemSecurity webItemSecurity,
                         out UserManager userManager,
                         out IOptionsMonitor <ILog> optionsMonitor,
                         out TenantExtra tenantExtra,
                         out WebItemManagerSecurity webItemManagerSecurity,
                         out WebItemManager webItemManager,
                         out IConfiguration configuration,
                         out TenantLogoManager tenantLogoManager,
                         out AdditionalWhiteLabelSettingsHelper additionalWhiteLabelSettingsHelper,
                         out TenantUtil tenantUtil,
                         out CoreBaseSettings coreBaseSettings,
                         out CommonLinkUtility commonLinkUtility,
                         out SettingsManager settingsManager,
                         out StudioNotifyHelper studioNotifyHelper)
 {
     tenantManager                      = TenantManager;
     webItemSecurity                    = WebItemSecurity;
     userManager                        = UserManager;
     optionsMonitor                     = Options;
     tenantExtra                        = TenantExtra;
     webItemManagerSecurity             = WebItemManagerSecurity;
     webItemManager                     = WebItemManager;
     configuration                      = Configuration;
     tenantLogoManager                  = TenantLogoManager;
     additionalWhiteLabelSettingsHelper = AdditionalWhiteLabelSettingsHelper;
     tenantUtil         = TenantUtil;
     coreBaseSettings   = CoreBaseSettings;
     commonLinkUtility  = CommonLinkUtility;
     settingsManager    = SettingsManager;
     studioNotifyHelper = StudioNotifyHelper;
 }
        public void UserInfoAddedAfterInvite(UserInfo newUserInfo)
        {
            if (!CoreContext.UserManager.UserExists(newUserInfo.ID))
            {
                return;
            }

            INotifyAction notifyAction;
            var           footer = "social";

            if (CoreContext.Configuration.Personal)
            {
                if (CoreContext.Configuration.CustomMode)
                {
                    notifyAction = Actions.PersonalCustomModeAfterRegistration1;
                    footer       = "personalCustomMode";
                }
                else
                {
                    notifyAction = Actions.PersonalAfterRegistration1;
                    footer       = "personal";
                }
            }
            else if (TenantExtra.Enterprise)
            {
                var defaultRebranding = MailWhiteLabelSettings.Instance.IsDefault;
                notifyAction = defaultRebranding
                                   ? Actions.EnterpriseUserWelcomeV10
                                   : CoreContext.Configuration.CustomMode
                                         ? Actions.EnterpriseWhitelabelUserWelcomeCustomMode
                                         : Actions.EnterpriseWhitelabelUserWelcomeV10;
                footer = null;
            }
            else if (TenantExtra.Opensource)
            {
                notifyAction = Actions.OpensourceUserWelcomeV11;
                footer       = "opensource";
            }
            else
            {
                notifyAction = Actions.SaasUserWelcomeV115;
            }

            Func <string> greenButtonText = () => TenantExtra.Enterprise
                                      ? WebstudioNotifyPatternResource.ButtonAccessYourPortal
                                      : WebstudioNotifyPatternResource.ButtonAccessYouWebOffice;

            client.SendNoticeToAsync(
                notifyAction,
                null,
                StudioNotifyHelper.RecipientFromEmail(newUserInfo.Email, false),
                new[] { EMailSenderName },
                null,
                new TagValue(Tags.UserName, newUserInfo.FirstName.HtmlEncode()),
                new TagValue(Tags.MyStaffLink, GetMyStaffLink()),
                TagValues.GreenButton(greenButtonText, CommonLinkUtility.GetFullAbsolutePath("~").TrimEnd('/')),
                new TagValue(CommonTags.Footer, footer),
                new TagValue(CommonTags.MasterTemplate, CoreContext.Configuration.Personal ? "HtmlMasterPersonal" : "HtmlMaster"));
        }
Exemplo n.º 10
0
        public static ITagValue Image(StudioNotifyHelper studioNotifyHelper, int id, string imageFileName)
        {
            var imgSrc = studioNotifyHelper.GetNotificationImageUrl(imageFileName);

            var imgHtml = string.Format("<img style=\"border: 0; padding: 0; width: auto; height: auto;\" alt=\"\" src=\"{0}\"/>", imgSrc);

            var tagName = "Image" + (id > 0 ? id.ToString() : string.Empty);

            return(new TagValue(tagName, imgHtml));
        }
Exemplo n.º 11
0
 public void SendMsgBackupCompleted(Guid userId, string link)
 {
     client.SendNoticeToAsync(
         Actions.BackupCreated,
         null,
         new[] { StudioNotifyHelper.ToRecipient(userId) },
         new[] { EMailSenderName },
         null,
         new TagValue(Tags.OwnerName, CoreContext.UserManager.GetUsers(userId).DisplayUserName()));
 }
        public void SendAdminWelcome(UserInfo newUserInfo)
        {
            if (!CoreContext.UserManager.UserExists(newUserInfo.ID))
            {
                return;
            }

            if (!newUserInfo.IsActive)
            {
                throw new ArgumentException("User is not activated yet!");
            }

            INotifyAction notifyAction;
            var           tagValues = new List <ITagValue>();

            if (TenantExtra.Enterprise)
            {
                var defaultRebranding = MailWhiteLabelSettings.Instance.IsDefault;
                notifyAction = defaultRebranding ? Actions.EnterpriseAdminWelcomeV10 : Actions.EnterpriseWhitelabelAdminWelcomeV10;

                tagValues.Add(TagValues.GreenButton(() => WebstudioNotifyPatternResource.ButtonAccessControlPanel, CommonLinkUtility.GetFullAbsolutePath("~" + SetupInfo.ControlPanelUrl)));
            }
            else
            {
                notifyAction = Actions.SaasAdminWelcomeV10;

                tagValues.Add(TagValues.GreenButton(() => WebstudioNotifyPatternResource.ButtonConfigureRightNow, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetAdministration(ManagementType.General))));

                var tenant    = CoreContext.TenantManager.GetCurrentTenant();
                var analytics = StudioNotifyHelper.GetNotifyAnalytics(tenant.TenantId, notifyAction, false, true, false, false);
                tagValues.Add(new TagValue(CommonTags.Analytics, analytics));

                tagValues.Add(TagValues.TableTop());
                tagValues.Add(TagValues.TableItem(1, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-regional-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_regional, null, null));
                tagValues.Add(TagValues.TableItem(2, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-brand-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_brand, null, null));
                tagValues.Add(TagValues.TableItem(3, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-customize-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_customize, null, null));
                tagValues.Add(TagValues.TableItem(4, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-security-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_security, null, null));
                tagValues.Add(TagValues.TableItem(5, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-usertrack-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_usertrack, null, null));
                tagValues.Add(TagValues.TableItem(6, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-backup-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_backup, null, null));
                tagValues.Add(TagValues.TableItem(7, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-telephony-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_telephony, null, null));
                tagValues.Add(TagValues.TableBottom());

                tagValues.Add(new TagValue(CommonTags.Footer, "common"));
            }

            tagValues.Add(new TagValue(Tags.UserName, newUserInfo.FirstName.HtmlEncode()));

            client.SendNoticeToAsync(
                notifyAction,
                null,
                StudioNotifyHelper.RecipientFromEmail(newUserInfo.Email, false),
                new[] { EMailSenderName },
                null,
                tagValues.ToArray());
        }
Exemplo n.º 13
0
 public void SendUserWelcomePersonal(UserInfo newUserInfo)
 {
     client.SendNoticeToAsync(
         CoreContext.Configuration.CustomMode ? Actions.PersonalCustomModeAfterRegistration1 : Actions.PersonalAfterRegistration1,
         null,
         StudioNotifyHelper.RecipientFromEmail(newUserInfo.Email, true),
         new[] { EMailSenderName },
         null,
         new TagValue(CommonTags.Footer, CoreContext.Configuration.CustomMode ? "personalCustomMode" : "personal"),
         new TagValue(CommonTags.MasterTemplate, "HtmlMasterPersonal"));
 }
Exemplo n.º 14
0
 public void SendMailboxPasswordChanged(List <string> toEmails, string username, string address)
 {
     client.SendNoticeToAsync(
         Actions.MailboxPasswordChanged,
         null,
         StudioNotifyHelper.RecipientFromEmail(toEmails, false),
         new[] { EMailSenderName },
         null,
         new TagValue(Tags.UserName, username ?? string.Empty),
         new TagValue(Tags.Address, address ?? string.Empty));
 }
Exemplo n.º 15
0
 public void SendMsgRemoveUserDataFailed(Guid recipientId, Guid fromUserId, string fromUserName, string message)
 {
     client.SendNoticeToAsync(
         Actions.RemoveUserDataFailed,
         null,
         new[] { StudioNotifyHelper.ToRecipient(recipientId) },
         new[] { EMailSenderName },
         null,
         new TagValue(Tags.UserName, DisplayUserSettings.GetFullUserName(recipientId)),
         new TagValue(Tags.FromUserName, fromUserName.HtmlEncode()),
         new TagValue(Tags.FromUserLink, GetUserProfileLink(fromUserId)),
         new TagValue(Tags.Message, message));
 }
Exemplo n.º 16
0
        private static void BeforeTransferRequest(NotifyEngine sender, NotifyRequest request)
        {
            var aid   = Guid.Empty;
            var aname = string.Empty;

            if (SecurityContext.IsAuthenticated)
            {
                aid = SecurityContext.CurrentAccount.ID;
                if (CoreContext.UserManager.UserExists(aid))
                {
                    aname = CoreContext.UserManager.GetUsers(aid).DisplayUserName(false)
                            .Replace(">", "&#62")
                            .Replace("<", "&#60");
                }
            }

            IProduct product;
            IModule  module;

            CommonLinkUtility.GetLocationByRequest(out product, out module);
            if (product == null && CallContext.GetData("asc.web.product_id") != null)
            {
                product = WebItemManager.Instance[(Guid)CallContext.GetData("asc.web.product_id")] as IProduct;
            }

            var logoText = TenantWhiteLabelSettings.DefaultLogoText;

            if ((TenantExtra.Enterprise || CoreContext.Configuration.CustomMode) && !MailWhiteLabelSettings.Instance.IsDefault)
            {
                logoText = TenantLogoManager.GetLogoText();
            }

            request.Arguments.Add(new TagValue(CommonTags.AuthorID, aid));
            request.Arguments.Add(new TagValue(CommonTags.AuthorName, aname));
            request.Arguments.Add(new TagValue(CommonTags.AuthorUrl, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(aid))));
            request.Arguments.Add(new TagValue(CommonTags.VirtualRootPath, CommonLinkUtility.GetFullAbsolutePath("~").TrimEnd('/')));
            request.Arguments.Add(new TagValue(CommonTags.ProductID, product != null ? product.ID : Guid.Empty));
            request.Arguments.Add(new TagValue(CommonTags.ModuleID, module != null ? module.ID : Guid.Empty));
            request.Arguments.Add(new TagValue(CommonTags.ProductUrl, CommonLinkUtility.GetFullAbsolutePath(product != null ? product.StartURL : "~")));
            request.Arguments.Add(new TagValue(CommonTags.DateTime, TenantUtil.DateTimeNow()));
            request.Arguments.Add(new TagValue(CommonTags.RecipientID, Context.SYS_RECIPIENT_ID));
            request.Arguments.Add(new TagValue(CommonTags.ProfileUrl, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetMyStaff())));
            request.Arguments.Add(new TagValue(CommonTags.RecipientSubscriptionConfigURL, CommonLinkUtility.GetMyStaff()));
            request.Arguments.Add(new TagValue(CommonTags.HelpLink, CommonLinkUtility.GetHelpLink(false)));
            request.Arguments.Add(new TagValue(CommonTags.LetterLogoText, logoText));
            request.Arguments.Add(new TagValue(CommonTags.MailWhiteLabelSettings, MailWhiteLabelSettings.Instance));
            request.Arguments.Add(new TagValue(CommonTags.SendFrom, CoreContext.TenantManager.GetCurrentTenant().Name));
            request.Arguments.Add(new TagValue(CommonTags.ImagePath, StudioNotifyHelper.GetNotificationImageUrl("").TrimEnd('/')));

            AddLetterLogo(request);
        }
Exemplo n.º 17
0
        public void SendMsgTfaReset(UserInfo userInfo)
        {
            var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(userInfo.Email.ToLower(), ConfirmType.TfaActivation);

            Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonChangeTfa;

            client.SendNoticeToAsync(
                Actions.TfaChange,
                null,
                StudioNotifyHelper.RecipientFromEmail(userInfo.Email, false),
                new[] { EMailSenderName },
                null,
                TagValues.GreenButton(greenButtonText, confirmationUrl));
        }
Exemplo n.º 18
0
 public void SendMsgReassignsCompleted(Guid recipientId, UserInfo fromUser, UserInfo toUser)
 {
     client.SendNoticeToAsync(
         Actions.ReassignsCompleted,
         null,
         new[] { StudioNotifyHelper.ToRecipient(recipientId) },
         new[] { EMailSenderName },
         null,
         new TagValue(Tags.UserName, DisplayUserSettings.GetFullUserName(recipientId)),
         new TagValue(Tags.FromUserName, fromUser.DisplayUserName()),
         new TagValue(Tags.FromUserLink, GetUserProfileLink(fromUser.ID)),
         new TagValue(Tags.ToUserName, toUser.DisplayUserName()),
         new TagValue(Tags.ToUserLink, GetUserProfileLink(toUser.ID)));
 }
 public StudioNotifyServiceSenderScope(TenantManager tenantManager,
                                       UserManager userManager,
                                       SecurityContext securityContext,
                                       StudioNotifyHelper studioNotifyHelper,
                                       TenantExtra tenantExtra,
                                       CoreBaseSettings coreBaseSettings)
 {
     TenantManager      = tenantManager;
     UserManager        = userManager;
     SecurityContext    = securityContext;
     StudioNotifyHelper = studioNotifyHelper;
     TenantExtra        = tenantExtra;
     CoreBaseSettings   = coreBaseSettings;
 }
 public void Deconstruct(out TenantManager tenantManager,
                         out UserManager userManager,
                         out SecurityContext securityContext,
                         out StudioNotifyHelper studioNotifyHelper,
                         out TenantExtra tenantExtra,
                         out CoreBaseSettings coreBaseSettings)
 {
     tenantManager      = TenantManager;
     userManager        = UserManager;
     securityContext    = SecurityContext;
     studioNotifyHelper = StudioNotifyHelper;
     tenantExtra        = TenantExtra;
     coreBaseSettings   = CoreBaseSettings;
 }
Exemplo n.º 21
0
        public void SendMsgRestoreStarted(bool notifyAllUsers)
        {
            var owner = CoreContext.UserManager.GetUsers(CoreContext.TenantManager.GetCurrentTenant().OwnerId);
            var users =
                notifyAllUsers
                    ? StudioNotifyHelper.RecipientFromEmail(CoreContext.UserManager.GetUsers(EmployeeStatus.Active).Where(r => r.ActivationStatus == EmployeeActivationStatus.Activated).Select(u => u.Email).ToList(), false)
                    : owner.ActivationStatus == EmployeeActivationStatus.Activated ? StudioNotifyHelper.RecipientFromEmail(owner.Email, false) : new IDirectRecipient[0];

            client.SendNoticeToAsync(
                Actions.RestoreStarted,
                null,
                users,
                new[] { EMailSenderName },
                null);
        }
        public void SendCongratulations(UserInfo u)
        {
            try
            {
                INotifyAction notifyAction;
                var           footer    = "common";
                var           analytics = string.Empty;

                if (TenantExtra.Enterprise)
                {
                    var defaultRebranding = MailWhiteLabelSettings.Instance.IsDefault;
                    notifyAction = defaultRebranding ? Actions.EnterpriseAdminActivationV10 : Actions.EnterpriseWhitelabelAdminActivationV10;
                    footer       = null;
                }
                else if (TenantExtra.Opensource)
                {
                    notifyAction = Actions.OpensourceAdminActivation;
                    footer       = "opensource";
                }
                else
                {
                    notifyAction = Actions.SaasAdminActivationV10;
                    var tenant = CoreContext.TenantManager.GetCurrentTenant();
                    analytics = StudioNotifyHelper.GetNotifyAnalytics(tenant.TenantId, notifyAction, false, true, false, false);
                }

                var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(u.Email, ConfirmType.EmailActivation);
                confirmationUrl += "&first=true";

                Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonConfirm;

                client.SendNoticeToAsync(
                    notifyAction,
                    null,
                    StudioNotifyHelper.RecipientFromEmail(u.Email, false),
                    new[] { EMailSenderName },
                    null,
                    new TagValue(Tags.UserName, u.FirstName.HtmlEncode()),
                    new TagValue(Tags.MyStaffLink, GetMyStaffLink()),
                    TagValues.GreenButton(greenButtonText, confirmationUrl),
                    new TagValue(CommonTags.Footer, footer),
                    new TagValue(CommonTags.Analytics, analytics));
            }
            catch (Exception error)
            {
                LogManager.GetLogger("ASC.Notify").Error(error);
            }
        }
Exemplo n.º 23
0
 public void SendMsgRemoveUserDataCompleted(Guid recipientId, Guid fromUserId, string fromUserName, long docsSpace, long crmSpace, long mailSpace, long talkSpace)
 {
     client.SendNoticeToAsync(
         CoreContext.Configuration.CustomMode ? Actions.RemoveUserDataCompletedCustomMode : Actions.RemoveUserDataCompleted,
         null,
         new[] { StudioNotifyHelper.ToRecipient(recipientId) },
         new[] { EMailSenderName },
         null,
         new TagValue(Tags.UserName, DisplayUserSettings.GetFullUserName(recipientId)),
         new TagValue(Tags.FromUserName, fromUserName.HtmlEncode()),
         new TagValue(Tags.FromUserLink, GetUserProfileLink(fromUserId)),
         new TagValue("DocsSpace", FileSizeComment.FilesSizeToString(docsSpace)),
         new TagValue("CrmSpace", FileSizeComment.FilesSizeToString(crmSpace)),
         new TagValue("MailSpace", FileSizeComment.FilesSizeToString(mailSpace)),
         new TagValue("TalkSpace", FileSizeComment.FilesSizeToString(talkSpace)));
 }
Exemplo n.º 24
0
        public void SendJoinMsg(string email, EmployeeType emplType)
        {
            var inviteUrl = CommonLinkUtility.GetConfirmationUrl(email, ConfirmType.EmpInvite, (int)emplType)
                            + String.Format("&emplType={0}", (int)emplType);

            Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonJoin;

            client.SendNoticeToAsync(
                Actions.JoinUsers,
                null,
                StudioNotifyHelper.RecipientFromEmail(email, true),
                new[] { EMailSenderName },
                null,
                new TagValue(Tags.InviteLink, inviteUrl),
                TagValues.GreenButton(greenButtonText, inviteUrl));
        }
Exemplo n.º 25
0
        public void SendEmailActivationInstructions(UserInfo user, string email)
        {
            var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(email, ConfirmType.EmailActivation);

            Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonActivateEmail;

            client.SendNoticeToAsync(
                Actions.ActivateEmail,
                null,
                StudioNotifyHelper.RecipientFromEmail(email, false),
                new[] { EMailSenderName },
                null,
                new TagValue(Tags.InviteLink, confirmationUrl),
                TagValues.GreenButton(greenButtonText, confirmationUrl),
                new TagValue(Tags.UserDisplayName, (user.DisplayUserName() ?? string.Empty).Trim()));
        }
        public void SendMsgRestoreCompleted(bool notifyAllUsers)
        {
            var owner = CoreContext.UserManager.GetUsers(CoreContext.TenantManager.GetCurrentTenant().OwnerId);

            var users =
                notifyAllUsers
                    ? CoreContext.UserManager.GetUsers(EmployeeStatus.Active).Select(u => StudioNotifyHelper.ToRecipient(u.ID)).ToArray()
                    : new[] { StudioNotifyHelper.ToRecipient(owner.ID) };

            client.SendNoticeToAsync(
                Actions.RestoreCompleted,
                null,
                users,
                new[] { EMailSenderName },
                null,
                new TagValue(Tags.OwnerName, owner.DisplayUserName()));
        }
Exemplo n.º 27
0
        public void SendAdminWelcome(UserInfo newUserInfo)
        {
            if (!CoreContext.UserManager.UserExists(newUserInfo.ID))
            {
                return;
            }

            if (!newUserInfo.IsActive)
            {
                throw new ArgumentException("User is not activated yet!");
            }

            INotifyAction notifyAction;
            var           tagValues = new List <ITagValue>();

            if (TenantExtra.Enterprise)
            {
                var defaultRebranding = MailWhiteLabelSettings.Instance.IsDefault;
                notifyAction = defaultRebranding ? Actions.EnterpriseAdminWelcomeV10 : Actions.EnterpriseWhitelabelAdminWelcomeV10;

                tagValues.Add(TagValues.GreenButton(() => WebstudioNotifyPatternResource.ButtonAccessControlPanel, CommonLinkUtility.GetFullAbsolutePath(SetupInfo.ControlPanelUrl)));
            }
            else if (TenantExtra.Opensource)
            {
                notifyAction = Actions.OpensourceAdminWelcomeV11;
                tagValues.Add(new TagValue(CommonTags.Footer, "opensource"));
                tagValues.Add(new TagValue(Tags.ControlPanelUrl, CommonLinkUtility.GetFullAbsolutePath(SetupInfo.ControlPanelUrl).TrimEnd('/')));
            }
            else
            {
                notifyAction = Actions.SaasAdminWelcomeV115;
                //tagValues.Add(TagValues.GreenButton(() => WebstudioNotifyPatternResource.ButtonConfigureRightNow, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetAdministration(ManagementType.General))));
                tagValues.Add(new TagValue(CommonTags.Footer, "common"));
            }

            tagValues.Add(new TagValue(Tags.UserName, newUserInfo.FirstName.HtmlEncode()));

            client.SendNoticeToAsync(
                notifyAction,
                null,
                StudioNotifyHelper.RecipientFromEmail(newUserInfo.Email, false),
                new[] { EMailSenderName },
                null,
                tagValues.ToArray());
        }
Exemplo n.º 28
0
        public void UserPasswordChange(UserInfo userInfo)
        {
            var hash            = CoreContext.Authentication.GetUserPasswordStamp(userInfo.ID).ToString("s");
            var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(userInfo.Email, ConfirmType.PasswordChange, hash);

            Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonChangePassword;

            var action = CoreContext.Configuration.Personal
                             ? (CoreContext.Configuration.CustomMode ? Actions.PersonalCustomModePasswordChange : Actions.PersonalPasswordChange)
                             : Actions.PasswordChange;

            client.SendNoticeToAsync(
                action,
                null,
                StudioNotifyHelper.RecipientFromEmail(userInfo.Email, false),
                new[] { EMailSenderName },
                null,
                TagValues.GreenButton(greenButtonText, confirmationUrl));
        }
Exemplo n.º 29
0
        public void SendMsgProfileDeletion(UserInfo user)
        {
            var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(user.Email, ConfirmType.ProfileRemove);

            Func <string> greenButtonText = () => CoreContext.Configuration.Personal ? WebstudioNotifyPatternResource.ButtonConfirmTermination : WebstudioNotifyPatternResource.ButtonRemoveProfile;

            var action = CoreContext.Configuration.Personal
                             ? (CoreContext.Configuration.CustomMode ? Actions.PersonalCustomModeProfileDelete : Actions.PersonalProfileDelete)
                             : Actions.ProfileDelete;

            client.SendNoticeToAsync(
                action,
                null,
                StudioNotifyHelper.RecipientFromEmail(user.Email, false),
                new[] { EMailSenderName },
                null,
                TagValues.GreenButton(greenButtonText, confirmationUrl),
                new TagValue(CommonTags.Culture, user.GetCulture().Name));
        }
Exemplo n.º 30
0
        public void SendEmailChangeInstructions(UserInfo user, string email)
        {
            var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(email, ConfirmType.EmailChange, SecurityContext.CurrentAccount.ID);

            Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonChangeEmail;

            var action = CoreContext.Configuration.Personal
                             ? (CoreContext.Configuration.CustomMode ? Actions.PersonalCustomModeEmailChangeV115 : Actions.PersonalEmailChangeV115)
                             : Actions.EmailChangeV115;

            client.SendNoticeToAsync(
                action,
                null,
                StudioNotifyHelper.RecipientFromEmail(email, false),
                new[] { EMailSenderName },
                null,
                TagValues.GreenButton(greenButtonText, confirmationUrl),
                new TagValue(CommonTags.Culture, user.GetCulture().Name));
        }