public bool IsUnsubscribe(IDirectRecipient recipient, INotifyAction action, string objectID)
 {
     if (recipient == null) throw new ArgumentNullException("recipient");
     if (action == null) throw new ArgumentNullException("action");
     
     return subscriptionManager.IsUnsubscribe(sourceID, recipient.ID, action.ID, objectID);
 }        
        public string[] GetSubscriptionMethod(INotifyAction action, IRecipient recipient)
        {
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            return subscriptionManager.GetSubscriptionMethod(sourceID, action.ID, recipient.ID);
        }
        public void Subscribe(INotifyAction action, string objectID, IRecipient recipient)
        {
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            subscriptionManager.Subscribe(sourceID, action.ID, objectID, recipient.ID);
        }
        public string[] GetSubscriptions(INotifyAction action, IRecipient recipient, bool checkSubscribe = true)
        {
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            return subscriptionManager.GetSubscriptions(sourceID, action.ID, recipient.ID, checkSubscribe);
        }
        public virtual bool IsUnsubscribe(IDirectRecipient recipient, INotifyAction action, string objectID)
        {
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            return subscriptionProvider.IsUnsubscribe(recipient, action, objectID);
        }
Example #6
0
 public SendResponse(INotifyAction action, string senderName, IRecipient recipient, SendResult sendResult)
 {
     SenderName = senderName;
     Recipient = recipient;
     Result = sendResult;
     NotifyAction = action;
 }
Example #7
0
 public SendResponse(INotifyAction action, IRecipient recipient, Exception exc)
 {
     Result = SendResult.Impossible;
     Exception = exc;
     Recipient = recipient;
     NotifyAction = action;
 }
 public NoticeMessage(IDirectRecipient recipient, INotifyAction action, string objectID)
 {
     if (recipient == null) throw new ArgumentNullException("recipient");
     Recipient = recipient;
     Action = action;
     ObjectID = objectID;
 }
        public virtual void Subscribe(INotifyAction action, string objectID, IRecipient recipient)
        {
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            subscriptionProvider.Subscribe(action, objectID, recipient);
        }
 public ProjectEntityEngine(INotifyAction notifyAction, EngineFactory factory)
 {
     SubscriptionProvider = NotifySource.Instance.GetSubscriptionProvider();
     RecipientProvider = NotifySource.Instance.GetRecipientsProvider();
     NotifyAction = notifyAction;
     FileEngine = factory != null ? factory.GetFileEngine() : null;
     Factory = factory;
 }
Example #11
0
        private IPattern ChoosePattern(INotifyAction action, string senderName, Notify.Engine.NotifyRequest request)
        {
            if (action == NotifyConstants.Event_ShareDocument
                || action == NotifyConstants.Event_UpdateDocument)
                return ActionPatternProvider.GetPattern(action, senderName);

            return null;
        }
 public static bool IsSubscribed(this ISubscriptionProvider provider, INotifyAction action, IRecipient recipient,
                                 string objectID)
 {
     return Array.Exists(
         provider.GetSubscriptions(action, recipient),
         id => id == objectID || (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(objectID))
         );
 }
        private IPattern SelectPattern(INotifyAction action, string sender, NotifyRequest request)
        {
            if (action != Constants.ActionAdminNotify) return null; //after that pattern will be selected by xml

            var tagvalue = request.Arguments.Find(tag => tag.Tag.Name == "UNDERLYING_ACTION");
            if (tagvalue == null) return null;

            return ActionPatternProvider.GetPattern(new NotifyAction(Convert.ToString(tagvalue.Value), ""), sender);
        }
 public virtual IRecipient[] GetRecipients(INotifyAction action, string objectID)
 {
     if (action == null) throw new ArgumentNullException("action");
     var recipents = new List<IRecipient>(5);
     IRecipient[] directRecipients = _directSubscriptionProvider.GetRecipients(action, objectID) ??
                                     new IRecipient[0];
     recipents.AddRange(directRecipients);
     return recipents.ToArray();
 }
Example #15
0
 private IPattern ChoosePattern(INotifyAction action, string senderName, Notify.Engine.NotifyRequest request)
 {
     if (action == NotifyConstants.Event_NewCommentForMessage)
     {
         var tag = request.Arguments.Find(tv => tv.Tag.Name == "EventType");
         if (tag != null) return ActionPatternProvider.GetPattern(new NotifyAction(Convert.ToString(tag.Value), ""), senderName);
     }
     return null;
 }
        public IRecipient[] GetRecipients(INotifyAction action, string objectID)
        {
            if (action == null) throw new ArgumentNullException("action");

            return subscriptionManager.GetRecipients(sourceID, action.ID, objectID)
                .Select(r => recipientProvider.GetRecipient(r))
                .Where(r => r != null)
                .ToArray();
        }
Example #17
0
 public NoticeMessage(IDirectRecipient recipient, INotifyAction action, string objectID, IPattern pattern)
 {
     if (recipient == null) throw new ArgumentNullException("recipient");
     if (pattern == null) throw new ArgumentNullException("pattern");
     Recipient = recipient;
     Action = action;
     Pattern = pattern;
     ObjectID = objectID;
     ContentType = pattern.ContentType;
 }
 private IPattern ChoosePattern(INotifyAction action, string senderName, ASC.Notify.Engine.NotifyRequest request)
 {
     if (action == PhotoConst.NewEventComment)
     {
         if (request.Arguments.Exists((tv) => tv.Tag.Name == "FEED_TYPE"))
         {
             return ActionPatternProvider.GetPattern(PhotoConst.NewPhotoUploaded, senderName) ?? ActionPatternProvider.GetPattern(PhotoConst.NewPhotoUploaded);
         }
     }
     return null;
 }
 private IPattern ChoosePattern(INotifyAction action, string senderName, ASC.Notify.Engine.NotifyRequest request)
 {
     if (action == Constants.EditPage)
     {
         var tag = request.Arguments.Find(t => t.Tag == "ChangeType");
         if (tag != null && tag.Value.ToString() == "new wiki page comment")
         {
             return PatternProvider.GetPattern(new NotifyAction(tag.Value.ToString()), senderName);
         }
     }
     return null;
 }
 public static void SendNoticeAsync(string AuthorID, INotifyAction action, string objectID, SendNoticeCallback sendCallback, params ITagValue[] args)
 {
     InitiatorInterceptor initatorInterceptor = new InitiatorInterceptor(new DirectRecipient(AuthorID, ""));
     try
     {
         NotifyClient.AddInterceptor(initatorInterceptor);
         NotifyClient.SendNoticeAsync(action, objectID, sendCallback, args);
     }
     finally
     {
         NotifyClient.RemoveInterceptor(initatorInterceptor.Name);
     }
 }
Example #21
0
 private IPattern ChoosePattern(INotifyAction action, string senderName, ASC.Notify.Engine.NotifyRequest request)
 {
     if (action == Constants.EditPage)
     {
         var tag = request.Arguments.Find((tv) => tv.Tag.Name == "ChangeType");
         if (tag != null && tag.Value.ToString() == "new wiki page comment")
         {
             if (senderName == "email.sender") return PatternProvider.GetPattern("3");
             if (senderName == "messanger.sender") return PatternProvider.GetPattern("3_jabber");
         }
     }
     return null;
 }
Example #22
0
        public NotifyRequest(INotifySource notifySource, INotifyAction action, string objectID, IRecipient recipient)
        {
            if (notifySource == null) throw new ArgumentNullException("notifySource");
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            Properties = new Hashtable();
            Arguments = new List<ITagValue>();
            RequaredTags = new List<string>();
            Interceptors = new List<ISendInterceptor>();

            NotifySource = notifySource;
            Recipient = recipient;
            NotifyAction = action;
            ObjectID = objectID;

            IsNeedCheckSubscriptions = true;
        }
Example #23
0
        private void MigrationNotify(INotifyAction action, string region, string url, bool notify)
        {
            var users = CoreContext.UserManager.GetUsers()
                        .Where(u => notify ? u.ActivationStatus == EmployeeActivationStatus.Activated : u.IsOwner())
                        .Select(u => ToRecipient(u.ID));

            if (users.Any())
            {
                client.SendNoticeToAsync(
                    action,
                    null,
                    users.ToArray(),
                    new[] { EMailSenderName },
                    null,
                    new TagValue(Constants.TagRegionName, TransferResourceHelper.GetRegionDescription(region)),
                    new TagValue("PortalUrl", url));
            }
        }
        public virtual string[] GetSubscriptionMethod(INotifyAction action, IRecipient recipient)
        {
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            var senders = subscriptionProvider.GetSubscriptionMethod(action, recipient);
            if (senders == null || senders.Length == 0)
            {
                var parents = WalkUp(recipient);
                foreach (var parent in parents)
                {
                    senders = subscriptionProvider.GetSubscriptionMethod(action, parent);
                    if (senders != null && senders.Length != 0) break;
                }
            }

            return senders != null && 0 < senders.Length ? senders : defaultSenderMethods;
        }
        private void SendStorageEncryptionNotify(INotifyAction action, bool notifyAdminsOnly, string serverRootPath)
        {
            var users = notifyAdminsOnly
                    ? CoreContext.UserManager.GetUsersByGroup(Constants.GroupAdmin.ID)
                    : CoreContext.UserManager.GetUsers().Where(u => u.ActivationStatus.HasFlag(EmployeeActivationStatus.Activated));

            foreach (var u in users)
            {
                client.SendNoticeToAsync(
                    action,
                    null,
                    new[] { StudioNotifyHelper.ToRecipient(u.ID) },
                    new[] { EMailSenderName },
                    null,
                    new TagValue(Tags.UserName, u.FirstName.HtmlEncode()),
                    new TagValue(Tags.PortalUrl, serverRootPath),
                    new TagValue(Tags.ControlPanelUrl, GetControlPanelUrl(serverRootPath)));
            }
        }
Example #26
0
 private IPattern ChoosePattern(INotifyAction action, string senderName, ASC.Notify.Engine.NotifyRequest request)
 {
     if (action == Constants.EditPage)
     {
         var tag = request.Arguments.Find((tv) => tv.Tag.Name == "ChangeType");
         if (tag != null && tag.Value.ToString() == "new wiki page comment")
         {
             if (senderName == "email.sender")
             {
                 return(PatternProvider.GetPattern("3"));
             }
             if (senderName == "messanger.sender")
             {
                 return(PatternProvider.GetPattern("3_jabber"));
             }
         }
     }
     return(null);
 }
        private void MigrationNotify(INotifyAction action, string region, string url, bool notify, int?toTenantId = null)
        {
            var users = CoreContext.UserManager.GetUsers()
                        .Where(u => notify ? u.ActivationStatus.HasFlag(EmployeeActivationStatus.Activated) : u.IsOwner());

            if (users.Any())
            {
                var args = CreateArgs(region, url);
                if (action == Actions.MigrationPortalSuccessV115)
                {
                    foreach (var user in users)
                    {
                        var currentArgs = new List <ITagValue>(args);

                        var newTenantId     = toTenantId.HasValue ? toTenantId.Value : CoreContext.TenantManager.GetCurrentTenant().TenantId;
                        var hash            = CoreContext.Authentication.GetUserPasswordStamp(user.ID).ToString("s");
                        var confirmationUrl = url + "/" + CommonLinkUtility.GetConfirmationUrlRelative(newTenantId, user.Email, ConfirmType.PasswordChange, hash);

                        Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonSetPassword;
                        currentArgs.Add(TagValues.GreenButton(greenButtonText, confirmationUrl));

                        client.SendNoticeToAsync(
                            action,
                            null,
                            new IRecipient[] { user },
                            new[] { EMailSenderName },
                            null,
                            currentArgs.ToArray());
                    }
                }
                else
                {
                    client.SendNoticeToAsync(
                        action,
                        null,
                        users.Select(u => StudioNotifyHelper.ToRecipient(u.ID)).ToArray(),
                        new[] { EMailSenderName },
                        null,
                        args.ToArray());
                }
            }
        }
 public virtual string[] GetSubscriptionMethod(INotifyAction action, IRecipient recipient)
 {
     if (action == null)
         throw new ArgumentNullException("action");
     if (recipient == null)
         throw new ArgumentNullException("recipient");
     string[] senders = _directSubscriptionProvider.GetSubscriptionMethod(action, recipient);
     if (senders == null || senders.Length == 0)
     {
         List<IRecipient> parents = WalkUp(recipient);
         foreach (IRecipient parent in parents)
         {
             senders = _directSubscriptionProvider.GetSubscriptionMethod(action, parent);
             if (senders != null && senders.Length != 0) break;
         }
     }
     if (senders == null || senders.Length == 0)
         senders = _defaultSenderMethods;
     return senders;
 }
        public IPattern GetPattern(INotifyAction action, string senderName)
        {
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            if (senderName == null)
            {
                throw new ArgumentNullException("senderName");
            }

            IPattern pattern = null;
            Dictionary <string, IPattern> accord = null;

            if (_Accords.TryGetValue(action, out accord))
            {
                accord.TryGetValue(senderName, out pattern);
            }
            return(pattern ?? GetPattern(action));
        }
Example #30
0
        public virtual string[] GetSubscriptions(INotifyAction action, IRecipient recipient)
        {
            if (recipient == null)
            {
                throw new ArgumentNullException("recipient");
            }
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            var objects = new List <string>();

            string[] direct = _directSubscriptionProvider.GetSubscriptions(action, recipient) ?? new string[0];
            MergeObjects(objects, direct);
            List <IRecipient> parents = WalkUp(recipient);

            foreach (IRecipient parent in parents)
            {
                direct = _directSubscriptionProvider.GetSubscriptions(action, parent) ?? new string[0];
                if (recipient is IDirectRecipient)
                {
                    foreach (string groupsubscr in direct)
                    {
                        if (
                            !objects.Contains(groupsubscr)
                            &&
                            !_directSubscriptionProvider.IsUnsubscribe(recipient as IDirectRecipient, action,
                                                                       groupsubscr))
                        {
                            objects.Add(groupsubscr);
                        }
                    }
                }
                else
                {
                    MergeObjects(objects, direct);
                }
            }
            return(objects.ToArray());
        }
Example #31
0
        private void MigrationNotify(Tenant tenant, INotifyAction action, string region, string url, bool notify)
        {
            using var scope = ServiceProvider.CreateScope();
            var scopeClass = scope.ServiceProvider.GetService <NotifyHelperScope>();

            var(userManager, studioNotifyHelper, studioNotifySource, _) = scopeClass;
            var client = WorkContext.NotifyContext.NotifyService.RegisterClient(studioNotifySource, scope);

            var users = userManager.GetUsers()
                        .Where(u => notify ? u.ActivationStatus.HasFlag(EmployeeActivationStatus.Activated) : u.IsOwner(tenant))
                        .Select(u => studioNotifyHelper.ToRecipient(u.ID))
                        .ToArray();

            if (users.Any())
            {
                client.SendNoticeToAsync(
                    action,
                    users,
                    new[] { StudioNotifyService.EMailSenderName },
                    new TagValue(Tags.RegionName, TransferResourceHelper.GetRegionDescription(region)),
                    new TagValue(Tags.PortalUrl, url));
            }
        }
Example #32
0
        private NotifyRequest CreateRequest(INotifyAction action, string objectID, IRecipient recipient, ITagValue[] args, string[] senders, bool checkSubsciption)
        {
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            if (recipient == null)
            {
                throw new ArgumentNullException("recipient");
            }

            var request = new NotifyRequest(notifySource, action, objectID, recipient)
            {
                SenderNames = senders,
                IsNeedCheckSubscriptions = checkSubsciption
            };

            if (args != null)
            {
                request.Arguments.AddRange(args);
            }
            return(request);
        }
        public virtual string[] GetSubscriptions(Tenant tenant, INotifyAction action, IRecipient recipient, bool checkSubscription = true)
        {
            if (recipient == null)
            {
                throw new ArgumentNullException("recipient");
            }
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }

            var objects = new List <string>();
            var direct  = subscriptionProvider.GetSubscriptions(tenant, action, recipient, checkSubscription) ?? new string[0];

            MergeObjects(objects, direct);
            var parents = WalkUp(tenant, recipient);

            foreach (var parent in parents)
            {
                direct = subscriptionProvider.GetSubscriptions(tenant, action, parent, checkSubscription) ?? new string[0];
                if (recipient is IDirectRecipient)
                {
                    foreach (var groupsubscr in direct)
                    {
                        if (!objects.Contains(groupsubscr) && !subscriptionProvider.IsUnsubscribe(recipient as IDirectRecipient, action, groupsubscr))
                        {
                            objects.Add(groupsubscr);
                        }
                    }
                }
                else
                {
                    MergeObjects(objects, direct);
                }
            }
            return(objects.ToArray());
        }
        private int ConvertToNotifyByValue(ISubscriptionManager subscriptionManager, INotifyAction action)
        {
            var notifyByArray = subscriptionManager.SubscriptionProvider.GetSubscriptionMethod(action, GetCurrentRecipient());

            if (notifyByArray.Length == 1)
            {
                if (notifyByArray.Contains(ASC.Core.Configuration.Constants.NotifyEMailSenderSysName))
                {
                    return(0);
                }
                if (notifyByArray.Contains(ASC.Core.Configuration.Constants.NotifyMessengerSenderSysName))
                {
                    return(1);
                }
            }
            if (notifyByArray.Length == 2)
            {
                if (notifyByArray.Contains(ASC.Core.Configuration.Constants.NotifyEMailSenderSysName) && notifyByArray.Contains(ASC.Core.Configuration.Constants.NotifyMessengerSenderSysName))
                {
                    return(2);
                }
            }
            return(0);
        }
 public void UpdateSubscriptionMethod(INotifyAction action, IRecipient recipient, params string[] senderNames)
 {
     provider.UpdateSubscriptionMethod(GetAdminAction(action), recipient, senderNames);
 }
Example #36
0
        public void Subscribe(string objectID, INotifyAction notifyAction)
        {
            var provider = BookmarkingNotifySource.Instance.GetSubscriptionProvider();

            provider.Subscribe(notifyAction, objectID, GetCurrentRecipient());
        }
 public bool IsSubscribed(string objectID, INotifyAction notifyAction)
 {
     return(_service.IsSubscribed(objectID, notifyAction));
 }
 public void UnSubscribe(INotifyAction action, IRecipient recipient)
 {
     throw new NotSupportedException("use UnSubscribe(INotifyAction, string, IRecipient )");
 }
        private void MigrationNotify(INotifyAction action, string region, string url, bool notify)
        {
            var users = CoreContext.UserManager.GetUsers()
                .Where(u => notify ? u.ActivationStatus == EmployeeActivationStatus.Activated : u.IsOwner())
                .Select(u => ToRecipient(u.ID));

            if (users.Any())
            {
                client.SendNoticeToAsync(
                    action,
                    null,
                    users.ToArray(),
                    new[] { EMailSenderName },
                    null,
                    new TagValue(Constants.TagRegionName, TransferResourceHelper.GetRegionDescription(region)),
                    new TagValue(Constants.TagPortalUrl, url));
            }
        }
Example #40
0
 public void SendNoticeAsync(INotifyAction action, string objectID, IRecipient recipient, bool checkSubscription, params ITagValue[] args)
 {
     SendNoticeToAsync(action, objectID, new[] { recipient }, null, checkSubscription, args);
 }
 public bool IsUnsubscribe(IDirectRecipient recipient, INotifyAction action, string objectID)
 {
     return(provider.IsUnsubscribe(recipient, action, objectID));
 }
Example #42
0
 public void SendNoticeToAsync(INotifyAction action, string objectID, IRecipient[] recipients, string[] senderNames, params ITagValue[] args)
 {
     SendNoticeToAsync(action, objectID, recipients, senderNames, false, args);
 }
Example #43
0
 public void SendNoticeAsync(INotifyAction action, string objectID, IRecipient recipient, params ITagValue[] args)
 {
     SendNoticeToAsync(action, objectID, new[] { recipient }, null, false, args);
 }
Example #44
0
 public void SendNoticeToAsync(INotifyAction action, string objectID, IRecipient[] recipients, string[] senderNames, SendNoticeCallback sendCallback, params ITagValue[] args)
 {
     SendNoticeToAsync(action, objectID, recipients, senderNames, sendCallback, false, args);
 }
Example #45
0
 public void SendNoticeAsync(INotifyAction action, string objectID, IRecipient recipient, SendNoticeCallback sendCallback, params ITagValue[] args)
 {
     SendNoticeToAsync(action, objectID, new[] { recipient }, null, sendCallback, false, args);
 }
Example #46
0
 public void SendNoticeAsync(INotifyAction action, string objectID, SendNoticeCallback sendCallback, params ITagValue[] args)
 {
     var subscriptionSource = ProviderResolver.GetEnsure<ISubscriptionSource>(notifySource);
     var recipients = subscriptionSource.GetRecipients(action, objectID);
     SendNoticeToAsync(action, objectID, recipients, null, sendCallback, false, args);
 }
 public IRecipient[] GetRecipients(INotifyAction action, string objectID)
 {
     return(provider.GetRecipients(GetAdminAction(action), objectID));
 }
 public object GetSubscriptionRecord(INotifyAction action, IRecipient recipient, string objectID)
 {
     return(provider.GetSubscriptionRecord(GetAdminAction(action), recipient, objectID));
 }
 public string[] GetSubscriptionMethod(INotifyAction action, IRecipient recipient)
 {
     return(provider.GetSubscriptionMethod(GetAdminAction(action), recipient));
 }
 public string[] GetSubscriptions(INotifyAction action, IRecipient recipient, bool checkSubscription = true)
 {
     return(provider.GetSubscriptions(GetAdminAction(action), recipient, checkSubscription));
 }
Example #51
0
 public NotifyEventArgs(INotifyAction notifyAction, string objectID)
 {
     this.NotifyAction = notifyAction;
     this.ObjectID     = objectID;
 }
 public void UnSubscribe(INotifyAction action, IRecipient recipient)
 {
     provider.UnSubscribe(GetAdminAction(action), recipient);
 }
 private IEnumerable <string> GetSubscriptions(INotifyAction action)
 {
     return(SubscriptionProvider.GetSubscriptions(action, NotifySource.Instance.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString())));
 }
 public void UnSubscribe(INotifyAction action)
 {
     provider.UnSubscribe(GetAdminAction(action));
 }
 private IEnumerable<string> GetSubscriptions(INotifyAction action)
 {
     return SubscriptionProvider.GetSubscriptions(action, 
         NotifySource.Instance.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString()), false);
 }
 public void UnSubscribe(INotifyAction action, string objectID)
 {
     provider.UnSubscribe(GetAdminAction(action), objectID);
 }
Example #57
0
        public void UnSubscribe(string objectID, INotifyAction notifyAction, Guid?userID = null)
        {
            var provider = BookmarkingNotifySource.Instance.GetSubscriptionProvider();

            provider.UnSubscribe(notifyAction, objectID, GetRecipient(userID ?? SecurityContext.CurrentAccount.ID));
        }
 public void UnSubscribe(INotifyAction action, string objectID, IRecipient recipient)
 {
     provider.UnSubscribe(GetAdminAction(action), objectID, recipient);
 }
 public void UnSubscribe(string objectID, INotifyAction notifyAction)
 {
     _service.UnSubscribe(objectID, notifyAction);
 }
Example #60
0
 public void SendNoticeAsync(INotifyAction action, string objectID, IRecipient recipient, bool checkSubscription, params ITagValue[] args)
 {
     SendNoticeToAsync(action, objectID, new[] { recipient }, null, null, checkSubscription, args);
 }