예제 #1
0
        protected override IConfigDataProvider CreateSession()
        {
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, base.SessionSettings, 130, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Mobility\\Aggregation\\GetSubscriptionBase.cs");

            if (this.Mailbox == null)
            {
                if (this.Identity != null && this.Identity.MailboxIdParameter != null)
                {
                    this.Mailbox = this.Identity.MailboxIdParameter;
                }
                else
                {
                    ADObjectId adObjectId;
                    if (!base.TryGetExecutingUserId(out adObjectId))
                    {
                        throw new ExecutingUserPropertyNotFoundException("executingUserid");
                    }
                    this.Mailbox = new MailboxIdParameter(adObjectId);
                }
            }
            ADUser            aduser  = (ADUser)base.GetDataObject <ADUser>(this.Mailbox, tenantOrRootOrgRecipientSession, null, new LocalizedString?(Strings.ErrorUserNotFound(this.Mailbox.ToString())), new LocalizedString?(Strings.ErrorUserNotUnique(this.Mailbox.ToString())));
            IRecipientSession session = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(tenantOrRootOrgRecipientSession, aduser.OrganizationId, true);
            AggregationSubscriptionDataProvider aggregationSubscriptionDataProvider = null;

            try
            {
                aggregationSubscriptionDataProvider            = SubscriptionConfigDataProviderFactory.Instance.CreateSubscriptionDataProvider(this.AggregationTypeValue, AggregationTaskType.Get, session, aduser);
                aggregationSubscriptionDataProvider.LoadReport = this.IncludeReport;
            }
            catch (MailboxFailureException exception)
            {
                this.WriteDebugInfoAndError(exception, ErrorCategory.InvalidArgument, this.Mailbox);
            }
            return(aggregationSubscriptionDataProvider);
        }
예제 #2
0
        protected override IConfigDataProvider CreateSession()
        {
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, base.SessionSettings, 149, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Mobility\\Aggregation\\SetSubscriptionBase.cs");

            if (this.Mailbox == null)
            {
                if (this.Identity != null && this.Identity.MailboxIdParameter != null)
                {
                    this.Mailbox = this.Identity.MailboxIdParameter;
                }
                else
                {
                    ADObjectId adObjectId;
                    if (!base.TryGetExecutingUserId(out adObjectId))
                    {
                        throw new ExecutingUserPropertyNotFoundException("executingUserid");
                    }
                    this.Mailbox = new MailboxIdParameter(adObjectId);
                }
            }
            ADUser            adUser  = (ADUser)base.GetDataObject <ADUser>(this.Mailbox, tenantOrRootOrgRecipientSession, null, new LocalizedString?(Strings.ErrorUserNotFound(this.Mailbox.ToString())), new LocalizedString?(Strings.ErrorUserNotUnique(this.Mailbox.ToString())));
            IRecipientSession session = AggregationTaskUtils.VerifyIsWithinWriteScopes(tenantOrRootOrgRecipientSession, adUser, new Task.TaskErrorLoggingDelegate(this.WriteDebugInfoAndError));
            AggregationSubscriptionDataProvider result = null;

            try
            {
                result = SubscriptionConfigDataProviderFactory.Instance.CreateSubscriptionDataProvider(this.AggregationType, AggregationTaskType.Set, session, adUser);
            }
            catch (MailboxFailureException exception)
            {
                this.WriteDebugInfoAndError(exception, ErrorCategory.InvalidArgument, this.Mailbox);
            }
            return(result);
        }
예제 #3
0
        protected override IConfigurable PrepareDataObject()
        {
            PopSubscriptionProxy popSubscriptionProxy = (PopSubscriptionProxy)base.PrepareDataObject();

            if (this.Force == false)
            {
                AggregationSubscriptionDataProvider aggregationSubscriptionDataProvider = (AggregationSubscriptionDataProvider)base.DataSession;
                if (base.Mailbox == null)
                {
                    ADObjectId adobjectId;
                    if (!base.TryGetExecutingUserId(out adobjectId))
                    {
                        throw new ExecutingUserPropertyNotFoundException("executingUserid");
                    }
                }
                else
                {
                    ADObjectId internalADObjectId = base.Mailbox.InternalADObjectId;
                }
                LocalizedException exception;
                if (!Pop3AutoProvision.ValidatePopSettings(popSubscriptionProxy.LeaveOnServer, popSubscriptionProxy.AggregationType == AggregationType.Mirrored, popSubscriptionProxy.IncomingServer, popSubscriptionProxy.IncomingPort, popSubscriptionProxy.IncomingUserName, this.password, popSubscriptionProxy.IncomingAuthentication, popSubscriptionProxy.IncomingSecurity, aggregationSubscriptionDataProvider.UserLegacyDN, CommonLoggingHelper.SyncLogSession, out exception))
                {
                    base.WriteDebugInfoAndError(exception, ErrorCategory.InvalidArgument, this.DataObject);
                }
            }
            popSubscriptionProxy.SetPassword(this.password);
            base.WriteDebugInfo();
            return(popSubscriptionProxy);
        }
예제 #4
0
        private IAutoProvision[] ClientsToUse()
        {
            List <IAutoProvision> list = new List <IAutoProvision>();
            bool flag = false;

            CommonLoggingHelper.SyncLogSession.LogVerbose((TSLID)1273UL, "Protocols specified in the command line: Hotmail:{0}, Imap:{1}, Pop:{2}", new object[]
            {
                this.Hotmail,
                this.Imap,
                this.Pop
            });
            AggregationSubscriptionDataProvider aggregationSubscriptionDataProvider = (AggregationSubscriptionDataProvider)base.DataSession;

            if (this.Hotmail == true)
            {
                list.Add(new DeltaSyncAutoProvision(base.EmailAddress, this.Password));
                flag = true;
            }
            if (this.Imap == true)
            {
                list.Add(new IMAPAutoProvision(base.EmailAddress, this.Password));
                flag = true;
            }
            if (this.Pop == true)
            {
                list.Add(new Pop3AutoProvision(base.EmailAddress, this.Password, aggregationSubscriptionDataProvider.UserLegacyDN));
                flag = true;
            }
            if (flag)
            {
                return(list.ToArray());
            }
            CommonLoggingHelper.SyncLogSession.LogVerbose((TSLID)1274UL, "Building protocol list dynamically from our permissions ...", new object[0]);
            if (base.ExchangeRunspaceConfig.CalculateScopeSetForExchangeCmdlet(base.MyInvocation.MyCommand.Name, new string[]
            {
                "Hotmail"
            }, base.CurrentOrganizationId, null) != null)
            {
                CommonLoggingHelper.SyncLogSession.LogVerbose((TSLID)1275UL, "Hotmail Permissions found.", new object[0]);
                list.Add(new DeltaSyncAutoProvision(base.EmailAddress, this.Password));
            }
            if (base.ExchangeRunspaceConfig.CalculateScopeSetForExchangeCmdlet(base.MyInvocation.MyCommand.Name, new string[]
            {
                "Imap"
            }, base.CurrentOrganizationId, null) != null)
            {
                CommonLoggingHelper.SyncLogSession.LogVerbose((TSLID)1276UL, "Imap Permissions found.", new object[0]);
                list.Add(new IMAPAutoProvision(base.EmailAddress, this.Password));
            }
            if (base.ExchangeRunspaceConfig.CalculateScopeSetForExchangeCmdlet(base.MyInvocation.MyCommand.Name, new string[]
            {
                "Pop"
            }, base.CurrentOrganizationId, null) != null)
            {
                CommonLoggingHelper.SyncLogSession.LogVerbose((TSLID)1277UL, "Pop Permissions found.", new object[0]);
                list.Add(new Pop3AutoProvision(base.EmailAddress, this.Password, aggregationSubscriptionDataProvider.UserLegacyDN));
            }
            return(list.ToArray());
        }
        protected override IConfigurable PrepareDataObject()
        {
            IConfigurable configurable = base.PrepareDataObject();

            if (this.ValidateSecret == null && this.ResendVerification == false)
            {
                return(configurable);
            }
            PimSubscriptionProxy pimSubscriptionProxy        = (PimSubscriptionProxy)configurable;
            AggregationSubscriptionDataProvider dataProvider = (AggregationSubscriptionDataProvider)base.DataSession;

            AggregationTaskUtils.ProcessSendAsSpecificParameters(pimSubscriptionProxy, this.ValidateSecret, this.ResendVerification, dataProvider, new Task.TaskErrorLoggingDelegate(base.WriteDebugInfoAndError));
            base.WriteDebugInfo();
            return(pimSubscriptionProxy);
        }
예제 #6
0
        protected override IConfigDataProvider CreateSession()
        {
            IRecipientSession  tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, base.SessionSettings, 82, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Mobility\\Aggregation\\RemoveSubscriptionBase.cs");
            MailboxIdParameter mailboxIdParameter      = this.GetMailboxIdParameter();
            ADUser             adUser                  = (ADUser)base.GetDataObject <ADUser>(mailboxIdParameter, tenantOrRootOrgRecipientSession, null, new LocalizedString?(Strings.ErrorUserNotFound(mailboxIdParameter.ToString())), new LocalizedString?(Strings.ErrorUserNotUnique(mailboxIdParameter.ToString())));
            IRecipientSession  session                 = AggregationTaskUtils.VerifyIsWithinWriteScopes(tenantOrRootOrgRecipientSession, adUser, new Task.TaskErrorLoggingDelegate(this.WriteDebugInfoAndError));
            AggregationSubscriptionDataProvider result = null;

            try
            {
                AggregationType aggregationType = this.AggregationType;
                if (this.Identity != null && this.Identity.AggregationType != null)
                {
                    aggregationType = this.Identity.AggregationType.Value;
                }
                result = SubscriptionConfigDataProviderFactory.Instance.CreateSubscriptionDataProvider(aggregationType, AggregationTaskType.Remove, session, adUser);
            }
            catch (MailboxFailureException exception)
            {
                this.WriteDebugInfoAndError(exception, ErrorCategory.InvalidArgument, mailboxIdParameter);
            }
            return(result);
        }
        internal static void ProcessSendAsSpecificParameters(PimSubscriptionProxy subscriptionProxy, string validateSecret, bool resendVerification, AggregationSubscriptionDataProvider dataProvider, Task.TaskErrorLoggingDelegate taskErrorLoggingDelegate)
        {
            SyncUtilities.ThrowIfArgumentNull("subscriptionProxy", subscriptionProxy);
            SyncUtilities.ThrowIfArgumentNull("dataProvider", dataProvider);
            SyncUtilities.ThrowIfArgumentNull("taskErrorLoggingDelegate", taskErrorLoggingDelegate);
            SendAsManager sendAsManager = new SendAsManager();

            if (validateSecret != null)
            {
                if (sendAsManager.ValidateSharedSecret(subscriptionProxy.Subscription, validateSecret))
                {
                    AggregationTaskUtils.EnableAlwaysShowFrom(dataProvider.SubscriptionExchangePrincipal);
                }
                else
                {
                    taskErrorLoggingDelegate(new ValidateSecretFailureException(), (ErrorCategory)1003, subscriptionProxy);
                }
            }
            if (resendVerification)
            {
                IEmailSender emailSender = subscriptionProxy.Subscription.CreateEmailSenderFor(dataProvider.ADUser, dataProvider.SubscriptionExchangePrincipal);
                sendAsManager.ResendVerificationEmail(subscriptionProxy.Subscription, emailSender);
            }
        }