/// <summary>
        /// Notify user about his profile updated
        /// </summary>
        public void UserInfoUpdated(UserInfo prevUserInfo, UserInfo newUserInfo, string password)
        {
            UserInfo Author = null;

            if (CoreContext.UserManager.UserExists(SecurityContext.CurrentAccount.ID))
            {
                Author = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            }

            ISendInterceptor initInterceptor = null;

            if (Author != null)
            {
                initInterceptor = new InitiatorInterceptor(new[] { UserInfoAsRecipient(Author) });
                client.AddInterceptor(initInterceptor);
            }

            client.SendNoticeToAsync(
                Constants.ActionYourProfileUpdated,
                null,
                new[] { UserInfoAsRecipient(newUserInfo) },
                AllSenderNames,
                null,
                new TagValue(Constants.TagProfileChanges, GetUserInfoChanges(prevUserInfo, newUserInfo)),
                new TagValue(Constants.TagUserName, newUserInfo.DisplayUserName()),
                new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()),
                new TagValue(Constants.TagPassword, password),
                new TagValue(Constants.TagIsPasswordChange, password != null)
                );

            if (initInterceptor != null)
            {
                client.RemoveInterceptor(initInterceptor.Name);
            }
        }
Beispiel #2
0
        public void Add(ISendInterceptor interceptor)
        {
            if (interceptor == null)
            {
                throw new ArgumentNullException("interceptor");
            }
            if (string.IsNullOrEmpty(interceptor.Name))
            {
                throw new ArgumentException("empty name property", "interceptor");
            }

            switch (interceptor.Lifetime)
            {
            case InterceptorLifetime.Call:
                AddInternal(interceptor, callInterceptors);
                break;

            case InterceptorLifetime.Global:
                AddInternal(interceptor, globalInterceptors);
                break;

            default:
                throw new NotImplementedException();
            }
        }
Beispiel #3
0
 private void AddInternal(ISendInterceptor interceptor, Dictionary <string, ISendInterceptor> storage)
 {
     lock (syncRoot)
     {
         storage[interceptor.Name] = interceptor;
     }
 }
        public void UserPasswordChanged(Guid userID, string password)
        {
            var author = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            var user   = CoreContext.UserManager.GetUsers(userID);

            ISendInterceptor initInterceptor = null;

            if (!ASC.Core.Users.Constants.LostUser.Equals(author))
            {
                initInterceptor = new InitiatorInterceptor(new[] { ToRecipient(author.ID) });
                client.AddInterceptor(initInterceptor);
            }

            client.SendNoticeToAsync(
                Constants.ActionPasswordChanged,
                null,
                new[] { ToRecipient(user.ID) },
                new[] { EMailSenderName },
                null,
                new TagValue(Constants.TagUserName, user.DisplayUserName()),
                new TagValue(Constants.TagUserEmail, user.Email),
                new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()),
                new TagValue(Constants.TagPassword, password));

            if (initInterceptor != null)
            {
                client.RemoveInterceptor(initInterceptor.Name);
            }
        }
Beispiel #5
0
        private ISendInterceptor GetInternal(string name, Dictionary <string, ISendInterceptor> storage)
        {
            ISendInterceptor interceptor = null;

            lock (syncRoot)
            {
                storage.TryGetValue(name, out interceptor);
            }
            return(interceptor);
        }
        public ISendInterceptor Get(string name)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentException("empty name", "name");
            }

            ISendInterceptor result = null;

            result = GetInternal(name, callInterceptors);
            if (result == null)
            {
                result = GetInternal(name, globalInterceptors);
            }
            return(result);
        }
        public void Add(ISendInterceptor interceptor)
        {
            if (interceptor == null) throw new ArgumentNullException("interceptor");
            if (String.IsNullOrEmpty(interceptor.Name)) throw new ArgumentException("empty name property", "interceptor");

            switch (interceptor.Lifetime)
            {
                case InterceptorLifetime.Call:
                    AddInternal(interceptor, callInterceptors);
                    break;
                case InterceptorLifetime.Global:
                    AddInternal(interceptor, globalInterceptors);
                    break;
                default:
                    throw new NotImplementedException();
            }
        }
        /// <summary>
        /// notify user about his password changed
        /// </summary>
        public void UserPasswordChanged(Guid userID, string password)
        {
            UserInfo Author      = null;
            UserInfo newUserInfo = CoreContext.UserManager.GetUsers(userID);

            if (CoreContext.UserManager.UserExists(SecurityContext.CurrentAccount.ID))
            {
                Author = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            }

            ISendInterceptor initInterceptor = null;

            if (Author != null)
            {
                initInterceptor = new InitiatorInterceptor(new[] { UserInfoAsRecipient(Author) });
                client.AddInterceptor(initInterceptor);
            }

            client.SendNoticeToAsync(
                Constants.ActionPasswordChanged,
                null,
                new[] { UserInfoAsRecipient(newUserInfo) },
                new[] { EMailSenderName },
                null,
                new TagValue(Constants.TagUserName, newUserInfo.DisplayUserName()),
                new TagValue(Constants.TagUserEmail, newUserInfo.Email),
                new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()),
                new TagValue(Constants.TagPassword, password)
                );


            if (initInterceptor != null)
            {
                client.RemoveInterceptor(initInterceptor.Name);
            }
        }
Beispiel #9
0
 public void AddInterceptor(ISendInterceptor interceptor)
 {
     interceptors.Add(interceptor);
 }
 private void AddInternal(ISendInterceptor interceptor, Dictionary<string, ISendInterceptor> storage)
 {
     lock (syncRoot)
     {
         storage[interceptor.Name] = interceptor;
     }
 }
 public void AddInterceptor(ISendInterceptor interceptor)
 {
     interceptors.Add(interceptor);
 }