Пример #1
0
        protected override IConfigDataProvider CreateSession()
        {
            ADUser     adUser = null;
            ADObjectId executingUserId;

            if (!base.TryGetExecutingUserId(out executingUserId))
            {
                return(this.CreateDataProviderForNonMailboxUser());
            }
            MailboxIdParameter mailboxIdParameter = MailboxTaskHelper.ResolveMailboxIdentity(executingUserId, new Task.ErrorLoggerDelegate(base.WriteError));

            try
            {
                adUser = (ADUser)base.GetDataObject <ADUser>(mailboxIdParameter, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxNotFound(mailboxIdParameter.ToString())), new LocalizedString?(Strings.ErrorMailboxNotUnique(mailboxIdParameter.ToString())));
            }
            catch (ManagementObjectNotFoundException)
            {
                return(this.CreateDataProviderForNonMailboxUser());
            }
            if (this.Identity != null && this.Identity.InternalOWAExtensionId == null)
            {
                this.Identity.InternalOWAExtensionId = OWAExtensionHelper.CreateOWAExtensionId(this, new ADObjectId(), null, this.Identity.RawExtensionName);
            }
            if (this.Organization != null)
            {
                this.SetCurrentOrganizationId();
            }
            return(GetApp.CreateOwaExtensionDataProvider(this.Organization, base.TenantGlobalCatalogSession, base.SessionSettings, false, adUser, "Set-App", false, new Task.ErrorLoggerDelegate(base.WriteError)));
        }
Пример #2
0
 protected override void InternalProcessRecord()
 {
     OWAExtensionHelper.ProcessRecord(new Action(base.InternalProcessRecord), new Task.TaskErrorLoggingDelegate(base.WriteError), this.Identity);
     if (base.IsDebugOn)
     {
         base.WriteDebug(((OWAExtensionDataProvider)base.DataSession).RawMasterTableXml);
         base.WriteDebug(((OWAExtensionDataProvider)base.DataSession).RawOrgMasterTableXml);
     }
 }
Пример #3
0
        protected override IConfigDataProvider CreateSession()
        {
            MailboxIdParameter mailboxIdParameter = null;
            ADUser             aduser             = null;

            if (this.Identity != null)
            {
                if (this.Identity.InternalOWAExtensionId != null)
                {
                    mailboxIdParameter = new MailboxIdParameter(this.Identity.InternalOWAExtensionId.MailboxOwnerId);
                }
                else
                {
                    mailboxIdParameter = this.Identity.RawMailbox;
                }
            }
            if (mailboxIdParameter != null && this.Mailbox != null)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorConflictingMailboxes), ErrorCategory.InvalidOperation, this.Identity);
            }
            if (mailboxIdParameter == null)
            {
                ADObjectId adobjectId;
                base.TryGetExecutingUserId(out adobjectId);
                if (adobjectId == null && this.Mailbox == null)
                {
                    return(this.CreateDataProviderForNonMailboxUser());
                }
                mailboxIdParameter = (this.Mailbox ?? MailboxTaskHelper.ResolveMailboxIdentity(adobjectId, new Task.ErrorLoggerDelegate(base.WriteError)));
            }
            try
            {
                aduser = (ADUser)base.GetDataObject <ADUser>(mailboxIdParameter, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxNotFound(mailboxIdParameter.ToString())), new LocalizedString?(Strings.ErrorMailboxNotUnique(mailboxIdParameter.ToString())));
            }
            catch (ManagementObjectNotFoundException)
            {
                return(this.CreateDataProviderForNonMailboxUser());
            }
            if (this.Identity != null && this.Identity.InternalOWAExtensionId == null)
            {
                this.Identity.InternalOWAExtensionId = OWAExtensionHelper.CreateOWAExtensionId(this, aduser.Id, null, this.Identity.RawExtensionName);
            }
            ADScopeException ex;

            if (!base.TenantGlobalCatalogSession.TryVerifyIsWithinScopes(aduser, true, out ex))
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorCannotChangeMailboxOutOfWriteScope(aduser.Identity.ToString(), (ex == null) ? string.Empty : ex.Message), ex), ErrorCategory.InvalidOperation, aduser.Identity);
            }
            if (this.Organization != null)
            {
                this.SetCurrentOrganizationId();
            }
            return(GetApp.CreateOwaExtensionDataProvider(this.Organization, base.TenantGlobalCatalogSession, base.SessionSettings, !this.OrganizationApp, aduser, "Get-App", base.IsDebugOn, new Task.ErrorLoggerDelegate(base.WriteError)));
        }
Пример #4
0
        private IConfigDataProvider CreateDataProviderForNonMailboxUser()
        {
            if (base.IsDebugOn)
            {
                base.WriteDebug("Creating data provider for non mailbox user.");
            }
            IConfigDataProvider result = new OWAAppDataProviderForNonMailboxUser((this.Organization == null) ? null : this.Organization.RawIdentity, base.TenantGlobalCatalogSession, base.SessionSettings, !this.OrganizationApp, "Get-App");

            if (this.Identity != null && this.Identity.InternalOWAExtensionId == null)
            {
                this.Identity.InternalOWAExtensionId = OWAExtensionHelper.CreateOWAExtensionId(this, new ADObjectId(), null, this.Identity.RawExtensionName);
            }
            return(result);
        }
Пример #5
0
        private IConfigDataProvider CreateDataProviderForNonMailboxUser()
        {
            if (!this.OrganizationApp)
            {
                base.WriteError(new LocalizedException(Strings.ErrorParameterRequired("OrganizationApp")), ErrorCategory.InvalidArgument, null);
            }
            if (base.IsDebugOn)
            {
                base.WriteDebug("Creating data provider for non mailbox user.");
            }
            IConfigDataProvider result = new OWAAppDataProviderForNonMailboxUser((this.Organization == null) ? null : this.Organization.RawIdentity, base.TenantGlobalCatalogSession, base.SessionSettings, !this.OrganizationApp, "Set-App");

            if (this.Identity != null && this.Identity.InternalOWAExtensionId == null)
            {
                this.Identity.InternalOWAExtensionId = OWAExtensionHelper.CreateOWAExtensionId(this, new ADObjectId(), null, this.Identity.RawExtensionName);
            }
            return(result);
        }
Пример #6
0
        protected override IConfigDataProvider CreateSession()
        {
            MailboxIdParameter mailboxIdParameter = null;

            if (this.Identity != null)
            {
                if (this.Identity.InternalOWAExtensionId != null)
                {
                    mailboxIdParameter = new MailboxIdParameter(this.Identity.InternalOWAExtensionId.MailboxOwnerId);
                }
                else
                {
                    mailboxIdParameter = this.Identity.RawMailbox;
                }
            }
            if (mailboxIdParameter != null && this.Mailbox != null)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorConflictingMailboxes), ErrorCategory.InvalidOperation, this.Identity);
            }
            if (mailboxIdParameter == null)
            {
                ADObjectId executingUserId;
                if (!base.TryGetExecutingUserId(out executingUserId) && this.Mailbox == null)
                {
                    base.WriteError(new LocalizedException(Strings.ErrorParameterRequired("Mailbox")), ErrorCategory.InvalidArgument, null);
                }
                mailboxIdParameter = (this.Mailbox ?? MailboxTaskHelper.ResolveMailboxIdentity(executingUserId, new Task.ErrorLoggerDelegate(base.WriteError)));
            }
            this.adUser = (ADUser)base.GetDataObject <ADUser>(mailboxIdParameter, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxNotFound(mailboxIdParameter.ToString())), new LocalizedString?(Strings.ErrorMailboxNotUnique(mailboxIdParameter.ToString())));
            if (this.Identity != null && this.Identity.InternalOWAExtensionId == null)
            {
                this.Identity.InternalOWAExtensionId = OWAExtensionHelper.CreateOWAExtensionId(this, this.adUser.Id, null, this.Identity.RawExtensionName);
            }
            ADScopeException ex;

            if (!base.TenantGlobalCatalogSession.TryVerifyIsWithinScopes(this.adUser, true, out ex))
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorCannotChangeMailboxOutOfWriteScope(this.adUser.Identity.ToString(), (ex == null) ? string.Empty : ex.Message), ex), ErrorCategory.InvalidOperation, this.adUser.Identity);
            }
            OWAExtensionDataProvider owaextensionDataProvider = GetApp.CreateOwaExtensionDataProvider(null, base.TenantGlobalCatalogSession, base.SessionSettings, true, this.adUser, "EnableDisable-App", false, new Task.ErrorLoggerDelegate(base.WriteError));

            this.mailboxOwner = owaextensionDataProvider.MailboxSession.MailboxOwner.ObjectId.ToString();
            return(owaextensionDataProvider);
        }
Пример #7
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     OWAExtensionHelper.CleanupOWAExtensionDataProvider(base.DataSession);
     GC.SuppressFinalize(this);
 }
Пример #8
0
 protected override void InternalProcessRecord()
 {
     OWAExtensionHelper.ProcessRecord(new Action(base.InternalProcessRecord), new Task.TaskErrorLoggingDelegate(base.WriteError), this.DataObject.Identity);
 }