Exemplo n.º 1
0
        protected ADServerSettings CreateADServerSettingsForOrganization(bool useDCInAnySite = false)
        {
            ISessionState sessionState = this.CurrentTaskContext.SessionState;
            bool          flag         = false;

            if (sessionState != null)
            {
                flag = ExchangePropertyContainer.IsContainerInitialized(sessionState);
            }
            OrganizationId orgId = null;

            if (this.CurrentTaskContext.InvocationInfo != null && this.CurrentTaskContext.InvocationInfo.IsCmdletInvokedWithoutPSFramework && this.CurrentTaskContext.UserInfo != null)
            {
                orgId = this.CurrentTaskContext.UserInfo.CurrentOrganizationId;
            }
            else if (flag)
            {
                ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = ExchangePropertyContainer.GetExchangeRunspaceConfiguration(sessionState);
                if (exchangeRunspaceConfiguration != null)
                {
                    orgId = exchangeRunspaceConfiguration.OrganizationId;
                }
            }
            return(this.CreateServerSettings(orgId, useDCInAnySite));
        }
Exemplo n.º 2
0
        private void RetrieveAllScopes(ScopeRestrictionType scopeType, ADRawEntry givenObject, out Dictionary <ADObjectId, ADScope> customScopes, out Dictionary <ADObjectId, ADScope> exclusiveScopes)
        {
            customScopes    = new Dictionary <ADObjectId, ADScope>();
            exclusiveScopes = new Dictionary <ADObjectId, ADScope>();
            ScopeType scopeType2 = ScopeType.ExclusiveConfigScope;
            ScopeType scopeType3 = ScopeType.CustomConfigScope;

            if (scopeType == ScopeRestrictionType.RecipientScope)
            {
                scopeType2 = ScopeType.ExclusiveRecipientScope;
                scopeType3 = ScopeType.CustomRecipientScope;
            }
            ADPagedReader <ManagementScope> allScopes = this.configSession.GetAllScopes(this.orgId, scopeType);

            foreach (ManagementScope managementScope in allScopes)
            {
                if (managementScope.ScopeRestrictionType == scopeType)
                {
                    ExchangeRunspaceConfiguration.TryStampQueryFilterOnManagementScope(managementScope);
                    if (managementScope.Exclusive)
                    {
                        RbacScope rbacScope = new RbacScope(scopeType2, managementScope);
                        rbacScope.PopulateRootAndFilter(this.orgId, givenObject);
                        exclusiveScopes.Add(managementScope.OriginalId, rbacScope);
                    }
                    RbacScope rbacScope2 = new RbacScope(scopeType3, managementScope);
                    rbacScope2.PopulateRootAndFilter(this.orgId, givenObject);
                    customScopes.Add(managementScope.OriginalId, rbacScope2);
                }
            }
        }
Exemplo n.º 3
0
        private static void ValidateQueryString(string httpURL, ADRawEntry userEntry)
        {
            string text;
            string tenantOrganization = ExchangeRunspaceConfigurationSettings.FromUriConnectionString(httpURL, out text).TenantOrganization;
            string value = tenantOrganization;

            if (string.IsNullOrEmpty(tenantOrganization))
            {
                return;
            }
            AuthZLogger.SafeSetLogger(ConfigurationCoreMetadata.ManagedOrganization, value);
            OrganizationId organizationId = userEntry[ADObjectSchema.OrganizationId] as OrganizationId;

            if (organizationId != null && !ExchangeRunspaceConfiguration.IsAllowedOrganizationForPartnerAccounts(organizationId))
            {
                AuthZLogger.SafeAppendGenericError("ValidateQueryString", string.Format("Organization {0} not allowed for partner account.", organizationId.ToString()), false);
                ExTraceGlobals.AccessDeniedTracer.TraceError <ADObjectId>(0L, "EAP.ValidateQueryString returns AccessDenied because user {0} does not belong to the appropriate organization", userEntry.Id);
                throw new NotAllowedForPartnerAccessException(Strings.ErrorNotAllowedForPartnerAccess);
            }
            Uri uri;

            if (!Uri.TryCreate(httpURL, UriKind.Absolute, out uri))
            {
                AuthZLogger.SafeAppendGenericError("ValidateQueryString", string.Format("Url {0} Incorrect.", httpURL), false);
                ExTraceGlobals.AccessDeniedTracer.TraceError <ADObjectId, string, string>(0L, "EAP.ValidateQueryString returns AccessDenied because tenant user {0} requested partner access to {1} which is not found in the local forest and URL {2} is invalid", userEntry.Id, tenantOrganization, httpURL);
                throw new UrlInValidException(Strings.ErrorUrlInValid);
            }
            ExTraceGlobals.ADConfigTracer.TraceDebug(0L, "EAP.ValidateQueryString returns Success.");
        }
Exemplo n.º 4
0
 protected override void BeginProcessing()
 {
     ExTraceGlobals.PublicPluginAPITracer.TraceDebug((long)this.GetHashCode(), "[ConvertToExchangeXml.BeginProcessing] Enter.");
     try
     {
         ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = ExchangePropertyContainer.GetExchangeRunspaceConfiguration(this.SessionState);
         this.serializer = new PSObjectSerializer((exchangeRunspaceConfiguration != null) ? exchangeRunspaceConfiguration.TypeTable : null);
         base.WriteObject("<?xml version=\"1.0\"?>");
         base.WriteObject("<Objs>");
     }
     catch (Exception ex)
     {
         ExTraceGlobals.PublicPluginAPITracer.TraceError <Exception>((long)this.GetHashCode(), "[ConvertToExchangeXml.BeginProcessing] Exception: {0}", ex);
         TaskLogger.LogRbacEvent(TaskEventLogConstants.Tuple_PswsPublicAPIFailed, null, new object[]
         {
             "ConvertToExchangeXml.BeginProcessing",
             ex.ToString()
         });
         throw;
     }
     finally
     {
         ExTraceGlobals.PublicPluginAPITracer.TraceDebug((long)this.GetHashCode(), "[ConvertToExchangeXml.BeginProcessing] Exit.");
     }
 }
Exemplo n.º 5
0
        protected void RenderGeneralInformation()
        {
            base.Response.Write("<div class='diagBlock'>");
            LocalSession localSession = LocalSession.Current;
            ExchangeRunspaceConfiguration rbacConfiguration = localSession.RbacConfiguration;
            bool flag = localSession.IsInRole("Mailbox+MailboxFullAccess");

            this.Write("Logon user:"******"{0} [{1}]", localSession.Name, rbacConfiguration.ExecutingUserPrimarySmtpAddress));
            this.Write("User-Agent:", HttpContext.Current.Request.UserAgent);
            this.Write("SKU:", Util.IsDataCenter ? "DataCenter" : "On-Premise");
            if (flag)
            {
                this.Write("Mailbox server version:", localSession.Context.MailboxServerVersion);
            }
            else
            {
                this.Write("Mailbox account:", "None mailbox account.");
            }
            this.Write("Current server version:", Util.ApplicationVersion);
            this.Write("Request URL:", HttpContext.Current.GetRequestUrl().ToString());
            this.Write("Display language:", CultureInfo.CurrentCulture.IetfLanguageTag);
            if (flag)
            {
                this.Write("User time zone:", (localSession.UserTimeZone != null) ? localSession.UserTimeZone.DisplayName : "Not set.");
            }
            this.Write("RBAC roles:", this.GetRoles(localSession));
            this.Write("Features:", FlightProvider.Instance.GetAllEnabledFeatures().ToLogString <string>());
            VariantConfigurationSnapshot snapshotForCurrentUser = EacFlightUtility.GetSnapshotForCurrentUser();

            this.Write("Flights:", snapshotForCurrentUser.Flights.ToLogString <string>());
            base.Response.Write("</div>");
        }
Exemplo n.º 6
0
        internal override bool?IsInRoleCmdlet(ExchangeRunspaceConfiguration rbacConfiguration)
        {
            RbacQuery rbacQuery = new RbacQuery("Get-SupervisionPolicy");

            if (!rbacQuery.IsInRole(rbacConfiguration))
            {
                return(new bool?(false));
            }
            Supervision supervision = new Supervision();
            PowerShellResults <SupervisionStatus> @object = supervision.GetObject(null);

            if (@object.SucceededWithValue)
            {
                foreach (SupervisionStatus supervisionStatus in @object.Output)
                {
                    if (supervisionStatus.ClosedCampusPolicyEnabled)
                    {
                        return(new bool?(true));
                    }
                }
                return(new bool?(false));
            }
            base.LogCmdletError(@object, "ClosedCampus");
            return(null);
        }
        // Token: 0x0600036E RID: 878 RVA: 0x0000D874 File Offset: 0x0000BA74
        protected void UpdateAppsLinks(NavBarData navBarData, AuthZClientInfo effectiveCaller)
        {
            string domain = string.Empty;

            if (navBarData.AppsLinks == null)
            {
                return;
            }
            if (effectiveCaller != null && !string.IsNullOrWhiteSpace(effectiveCaller.PrimarySmtpAddress))
            {
                SmtpAddress smtpAddress = new SmtpAddress(effectiveCaller.PrimarySmtpAddress);
                if (smtpAddress.IsValidAddress)
                {
                    domain = smtpAddress.Domain;
                }
            }
            string deploymentId        = ExtensionDataHelper.GetDeploymentId(domain);
            List <NavBarLinkData> list = new List <NavBarLinkData>(navBarData.AppsLinks.Length);

            NavBarLinkData[] appsLinks = navBarData.AppsLinks;
            int i = 0;

            while (i < appsLinks.Length)
            {
                NavBarLinkData navBarLinkData = appsLinks[i];
                if ("ShellMarketplace".Equals(navBarLinkData.Id, StringComparison.Ordinal))
                {
                    if (Globals.IsPreCheckinApp)
                    {
                        navBarLinkData.Url          = ExtensionData.GetClientExtensionMarketplaceUrl(this.culture.LCID, HttpContext.Current.Request, false, deploymentId, null);
                        navBarLinkData.TargetWindow = "_blank";
                        goto IL_169;
                    }
                    ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = ExchangeRunspaceConfigurationCache.Singleton.Get(effectiveCaller, null, false);
                    if (exchangeRunspaceConfiguration.HasRoleOfType(RoleType.MyMarketplaceApps) && (string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["OfficeStoreUnavailable"]) || StringComparer.OrdinalIgnoreCase.Equals("false", ConfigurationManager.AppSettings["OfficeStoreUnavailable"])))
                    {
                        navBarLinkData.Url          = ExtensionData.GetClientExtensionMarketplaceUrl(this.culture.LCID, HttpContext.Current.Request, exchangeRunspaceConfiguration.HasRoleOfType(RoleType.MyReadWriteMailboxApps), deploymentId, null);
                        navBarLinkData.TargetWindow = "_blank";
                        goto IL_169;
                    }
                }
                else
                {
                    if ("ShellOfficeDotCom".Equals(navBarLinkData.Id, StringComparison.Ordinal))
                    {
                        navBarLinkData.TargetWindow = "_blank";
                        goto IL_169;
                    }
                    goto IL_169;
                }
IL_171:
                i++;
                continue;
IL_169:
                list.Add(navBarLinkData);
                goto IL_171;
            }
            navBarData.AppsLinks = list.ToArray();
        }
Exemplo n.º 8
0
 internal static PiiMap GetSessionPiiMap(ExchangeRunspaceConfiguration config)
 {
     if (config != null && config.PiiMapId != null)
     {
         return(PiiMapManager.Instance.GetOrAdd(config.PiiMapId));
     }
     return(null);
 }
Exemplo n.º 9
0
        public sealed override bool?TryIsInRole(ExchangeRunspaceConfiguration rbacConfiguration)
        {
            T    t;
            bool flag  = OrganizationCache.TryGetValue <T>(this.key, out t);
            bool value = flag && ((this.predicate != null) ? this.predicate(t) : ((bool)((object)t)));

            return(new bool?(value));
        }
Exemplo n.º 10
0
 internal static Uri ConstructHelpRenderingUrl(ExchangeRunspaceConfiguration rbacConfiguration)
 {
     return(HelpProvider.UrlConstructHelper("default", new string[]
     {
         HelpProvider.GetLoginInfo(),
         HelpProvider.GetServicePlanInfo(rbacConfiguration)
     }));
 }
        internal override bool?IsInRoleCmdlet(ExchangeRunspaceConfiguration rbacConfiguration)
        {
            RbacQuery rbacQuery = new RbacQuery("Get-CasMailbox");

            if (!rbacQuery.IsInRole(rbacConfiguration))
            {
                return(new bool?(true));
            }
            return(new bool?(!rbacConfiguration.ExecutingUserIsPopEnabled && !rbacConfiguration.ExecutingUserIsImapEnabled));
        }
Exemplo n.º 12
0
        internal static Uri ConstructHelpRenderingUrl(string helpAttributeId, ExchangeRunspaceConfiguration rbacConfiguration)
        {
            string contentId = HelpProvider.GetAppQualifier() + helpAttributeId;

            return(HelpProvider.UrlConstructHelper(contentId, new string[]
            {
                HelpProvider.GetLoginInfo(),
                HelpProvider.GetServicePlanInfo(rbacConfiguration)
            }));
        }
Exemplo n.º 13
0
        public sealed override bool?TryIsInRole(ExchangeRunspaceConfiguration rbacConfiguration)
        {
            if (this.descriptor == null)
            {
                this.descriptor = this.ecpFeature.GetFeatureDescriptor();
            }
            bool value = LoginUtil.CheckUrlAccess(this.descriptor.ServerPath);

            return(new bool?(value));
        }
Exemplo n.º 14
0
 internal static void VerifyIsInHoldScopes(bool isHoldEnabled, ExchangeRunspaceConfiguration runspaceConfig, ADRecipient sourceRecipient, string cmdlet, Task.TaskErrorLoggingDelegate writeErrorDelegate)
 {
     if (isHoldEnabled && !runspaceConfig.IsCmdletAllowedInScope(cmdlet, new string[]
     {
         "InPlaceHoldEnabled"
     }, sourceRecipient, ScopeLocation.RecipientWrite))
     {
         writeErrorDelegate(new TaskInvalidOperationException(Strings.InPlaceHoldScopeException(sourceRecipient.DisplayName)), ErrorCategory.InvalidOperation, null);
     }
 }
Exemplo n.º 15
0
        internal static Uri GetOriginalConnectionUri(ISessionState sessionState)
        {
            ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = ExchangePropertyContainer.GetExchangeRunspaceConfiguration(sessionState);

            if (exchangeRunspaceConfiguration == null || exchangeRunspaceConfiguration.ConfigurationSettings == null)
            {
                return(null);
            }
            return(exchangeRunspaceConfiguration.ConfigurationSettings.OriginalConnectionUri);
        }
Exemplo n.º 16
0
            public override bool?TryIsInRole(ExchangeRunspaceConfiguration rbacConfiguration)
            {
                OrganizationProperties arg;

                if (!OrganizationPropertyCache.TryGetOrganizationProperties(rbacConfiguration.OrganizationId, out arg))
                {
                    throw new ArgumentException("The organization does not exist in AD. OrgId:" + rbacConfiguration.OrganizationId);
                }
                return(new bool?(this.predicate(arg)));
            }
Exemplo n.º 17
0
        internal static string GetPodRedirectionTemplate(ISessionState sessionState)
        {
            ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = ExchangePropertyContainer.GetExchangeRunspaceConfiguration(sessionState);

            if (exchangeRunspaceConfiguration == null || exchangeRunspaceConfiguration.ConfigurationSettings == null)
            {
                return(null);
            }
            return(exchangeRunspaceConfiguration.ConfigurationSettings.PodRedirectionTemplate);
        }
Exemplo n.º 18
0
            public override bool?TryIsInRole(ExchangeRunspaceConfiguration rbacConfiguration)
            {
                ADRawEntry adrawEntry = this.TargetObject ?? (RbacQuery.LegacyTargetObject as ADRawEntry);

                if (adrawEntry != null && !(adrawEntry is ADConfigurationObject) && !(adrawEntry is OrganizationConfig))
                {
                    ScopeLocation scopeLocation = this.CmdletName.StartsWith("get-", StringComparison.OrdinalIgnoreCase) ? ScopeLocation.RecipientRead : ScopeLocation.RecipientWrite;
                    return(new bool?(rbacConfiguration.IsCmdletAllowedInScope(this.CmdletName, this.ParameterNames ?? new string[0], adrawEntry, scopeLocation)));
                }
                return(new bool?(rbacConfiguration.IsCmdletAllowedInScope(this.QualifiedCmdletName, this.ParameterNames, this.ScopeSet)));
            }
Exemplo n.º 19
0
        public override bool?TryIsInRole(ExchangeRunspaceConfiguration rbacConfiguration)
        {
            SmtpAddress smtpAddress = new SmtpAddress(HttpContextExtensions.CurrentUserLiveID());

            if (smtpAddress.IsValidAddress)
            {
                DomainCacheValue domainCacheValue = DomainCache.Singleton.Get(new SmtpDomainWithSubdomains(smtpAddress.Domain), RbacPrincipal.Current.RbacConfiguration.ExecutingUserOrganizationId);
                return(new bool?(domainCacheValue != null && this.predicate(domainCacheValue)));
            }
            return(new bool?(false));
        }
Exemplo n.º 20
0
        internal static Uri ConstructHelpRenderingUrl(ErrorRecord errorRecord, ExchangeRunspaceConfiguration rbacConfiguration)
        {
            string text = "e=" + "ms.exch.err." + errorRecord.Exception.GetType();

            return(HelpProvider.UrlConstructHelper("ms.exch.err.default", new string[]
            {
                text,
                HelpProvider.GetLoginInfo(),
                HelpProvider.GetServicePlanInfo(rbacConfiguration)
            }));
        }
Exemplo n.º 21
0
        internal override bool?IsInRoleCmdlet(ExchangeRunspaceConfiguration rbacConfiguration)
        {
            SendAddress sendAddress = new SendAddress();
            PowerShellResults <SendAddressRow> list = sendAddress.GetList(null, null);

            if (list.Succeeded)
            {
                return(new bool?(list.Output.Length > 2));
            }
            base.LogCmdletError(list, "SendAddressAvailable");
            return(new bool?(false));
        }
Exemplo n.º 22
0
        private ExchangeRunspaceConfiguration CreateRunspaceConfigurationFromExecutingUser()
        {
            this.CheckRecipientSessionIsNotNull();
            ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = Util.ReadExchangeRunspaceConfiguration(this.recipientSession, this.ExecutingUserId);

            if (exchangeRunspaceConfiguration == null)
            {
                Util.Tracer.TraceError <string>((long)this.GetHashCode(), "Unable to find executing user: {0}", this.ExecutingUserId);
                throw new ObjectNotFoundException(ServerStrings.ADUserNotFoundId(this.ExecutingUserId));
            }
            return(exchangeRunspaceConfiguration);
        }
Exemplo n.º 23
0
        private void ExtractRbacDataFromRunspace(object sender, EventArgs e)
        {
            ADObjectId     adobjectId     = null;
            OrganizationId organizationId = null;

            ExchangePropertyContainer.InitializeExchangePropertyContainerIfNeeded(this.context.SessionState, out adobjectId, out organizationId);
            ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = null;

            if (this.context.SessionState != null)
            {
                exchangeRunspaceConfiguration = ExchangePropertyContainer.GetExchangeRunspaceConfiguration(this.context.SessionState);
            }
            OrganizationId organizationId2;
            string         executingUserIdentityName;
            SmtpAddress    executingWindowsLiveId;

            if (exchangeRunspaceConfiguration == null)
            {
                if (this.context.SessionState != null)
                {
                    organizationId = (organizationId ?? ExchangePropertyContainer.GetExecutingUserOrganizationId(this.context.SessionState));
                    adobjectId     = (adobjectId ?? ExchangePropertyContainer.GetExecutingUserId(this.context.SessionState));
                }
                organizationId2           = organizationId;
                executingUserIdentityName = ((adobjectId == null) ? string.Empty : adobjectId.Name);
            }
            else
            {
                exchangeRunspaceConfiguration.TryGetExecutingUserId(out adobjectId);
                executingUserIdentityName = exchangeRunspaceConfiguration.IdentityName;
                exchangeRunspaceConfiguration.TryGetExecutingWindowsLiveId(out executingWindowsLiveId);
                organizationId  = (exchangeRunspaceConfiguration.PartnerMode ? OrganizationId.ForestWideOrgId : exchangeRunspaceConfiguration.OrganizationId);
                organizationId2 = exchangeRunspaceConfiguration.OrganizationId;
                SecurityIdentifier value;
                exchangeRunspaceConfiguration.TryGetExecutingUserSid(out value);
                CmdletLogger.SafeSetLogger(this.context.UniqueId, RpsCmdletMetadata.ExecutingUserSid, value);
            }
            if (this.context.InvocationInfo != null && this.context.InvocationInfo.IsVerboseOn && !TaskLogger.IsSetupLogging)
            {
                string executingUserId             = (adobjectId != null) ? adobjectId.ToCanonicalName() : string.Empty;
                string executingUserOrganizationId = (organizationId != null) ? organizationId.ToString() : string.Empty;
                string currentOrganizationId       = (organizationId2 != null) ? organizationId2.ToString() : string.Empty;
                if (this.context.CommandShell != null)
                {
                    this.context.CommandShell.WriteVerbose(Strings.VerboseExecutingUserContext(executingUserId, executingUserOrganizationId, currentOrganizationId, (exchangeRunspaceConfiguration == null) ? Strings.DisabledString : Strings.EnabledString));
                }
            }
            this.context.ExchangeRunspaceConfig = exchangeRunspaceConfiguration;
            this.context.UserInfo = new TaskUserInfo(organizationId, organizationId2, adobjectId, executingUserIdentityName, executingWindowsLiveId);
        }
Exemplo n.º 24
0
        internal override bool?IsInRoleCmdlet(ExchangeRunspaceConfiguration rbacConfiguration)
        {
            AcceptedDomains acceptedDomains         = new AcceptedDomains();
            PowerShellResults <AcceptedDomain> list = acceptedDomains.GetList(null, null);

            if (list.Succeeded)
            {
                return(new bool?((from x in list.Output
                                  where x.AuthenticationType == AuthenticationType.Managed
                                  select x).Count <AcceptedDomain>() > 0));
            }
            base.LogCmdletError(list, "OrgHasManagedDomains");
            return(new bool?(false));
        }
Exemplo n.º 25
0
        internal static string GetServicePlanName(ExchangeRunspaceConfiguration rbacConfiguration)
        {
            if (rbacConfiguration == null || rbacConfiguration.OrganizationId == null)
            {
                return(string.Empty);
            }
            OrganizationProperties organizationProperties;

            if (!OrganizationPropertyCache.TryGetOrganizationProperties(rbacConfiguration.OrganizationId, out organizationProperties))
            {
                return(string.Empty);
            }
            return(organizationProperties.ServicePlan);
        }
Exemplo n.º 26
0
        internal static string GetUserNameFromUserId(IRecipientSession recipientSession, string userId)
        {
            Util.ThrowIfNull(recipientSession, "recipientSession");
            Util.ThrowIfNullOrEmpty(userId, "userId");
            ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = Util.ReadExchangeRunspaceConfiguration(recipientSession, userId);

            if (exchangeRunspaceConfiguration == null)
            {
                Util.Tracer.TraceError <string>(0L, "Unable to find executing user: {0}", userId);
                throw new ObjectNotFoundException(ServerStrings.ADUserNotFoundId(userId));
            }
            string text = (!string.IsNullOrEmpty(exchangeRunspaceConfiguration.ExecutingUserDisplayName)) ? exchangeRunspaceConfiguration.ExecutingUserDisplayName : exchangeRunspaceConfiguration.IdentityName;

            return(text ?? string.Empty);
        }
Exemplo n.º 27
0
 private static string GetManagedOrganization(ExchangeRunspaceConfiguration runspaceConfiguration)
 {
     if (runspaceConfiguration.PartnerMode)
     {
         if (runspaceConfiguration.OrganizationId != null && runspaceConfiguration.OrganizationId != OrganizationId.ForestWideOrgId)
         {
             return(runspaceConfiguration.OrganizationId.GetFriendlyName());
         }
         if (!string.IsNullOrEmpty(runspaceConfiguration.ConfigurationSettings.TenantOrganization))
         {
             return(runspaceConfiguration.ConfigurationSettings.TenantOrganization);
         }
     }
     return(null);
 }
Exemplo n.º 28
0
 internal static bool TryGetErrorAssistanceUrl(LocalizedException exception, ExchangeRunspaceConfiguration rbacConfiguration, out Uri helpUrl)
 {
     helpUrl = null;
     if (!HelpProvider.ShouldConstructHelpUrlForException(exception))
     {
         return(false);
     }
     helpUrl = HelpProvider.UrlConstructHelper("ms.exch.err.default", new string[]
     {
         HelpProvider.GetErrorParam(exception),
         HelpProvider.GetLoginInfo(),
         HelpProvider.GetServicePlanInfo(rbacConfiguration)
     });
     return(true);
 }
Exemplo n.º 29
0
            public override bool?TryIsInRole(ExchangeRunspaceConfiguration rbacConfiguration)
            {
                bool?flag = this.Predicate.TryIsInRole(rbacConfiguration);

                if (flag == null)
                {
                    return(flag);
                }
                bool?flag2 = flag;

                if (flag2 == null)
                {
                    return(null);
                }
                return(new bool?(!flag2.GetValueOrDefault()));
            }
Exemplo n.º 30
0
        internal static Uri BuildCmdletProxyUri(string targetFqdn, ExchangeRunspaceConfiguration runspaceConfig, int targetVersion)
        {
            if (string.IsNullOrWhiteSpace(targetFqdn))
            {
                throw new ArgumentNullException("targetFqdn");
            }
            if (runspaceConfig == null)
            {
                throw new ArgumentNullException("runspaceConfig");
            }
            ExchangeRunspaceConfigurationSettings configurationSettings = runspaceConfig.ConfigurationSettings;

            ExAssert.RetailAssert(configurationSettings != null, "runspaceConfig.ConfigurationSettings should not be null.");
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("https://");
            stringBuilder.Append(targetFqdn);
            if (targetVersion >= Server.E15MinVersion)
            {
                stringBuilder.Append(":444/powershell/Powershell-proxy?");
            }
            else
            {
                stringBuilder.Append("/Powershell-proxy?");
            }
            stringBuilder.AppendFormat("{0}={1}", "X-Rps-CAT", Uri.EscapeDataString(configurationSettings.UserToken.CommonAccessTokenForCmdletProxy().Serialize()));
            stringBuilder.AppendFormat(";{0}={1}", "serializationLevel", configurationSettings.CurrentSerializationLevel.ToString());
            stringBuilder.AppendFormat(";{0}={1}", "clientApplication", configurationSettings.ClientApplication.ToString());
            if (configurationSettings.ClientApplication == ExchangeRunspaceConfigurationSettings.ExchangeApplication.ECP || configurationSettings.ClientApplication == ExchangeRunspaceConfigurationSettings.ExchangeApplication.EMC || configurationSettings.ClientApplication == ExchangeRunspaceConfigurationSettings.ExchangeApplication.OSP)
            {
                stringBuilder.AppendFormat(";{0}={1}", "proxyFullSerialization", "true");
            }
            string managedOrganization = ProxyHelper.GetManagedOrganization(runspaceConfig);

            if (!string.IsNullOrEmpty(managedOrganization))
            {
                stringBuilder.AppendFormat(";{0}", ProxyHelper.GetOrganizationAppendQueryIfNeeded(managedOrganization));
            }
            stringBuilder.AppendFormat(";{0}={1}", WellKnownHeader.CmdletProxyIsOn, "99C6ECEE-5A4F-47B9-AE69-49EAFB58F368");
            IActivityScope currentActivityScope = ActivityContext.GetCurrentActivityScope();

            if (currentActivityScope != null && currentActivityScope.ActivityId != Guid.Empty)
            {
                stringBuilder.AppendFormat(";{0}={1}", "RequestId48CD6591-0506-4D6E-9131-797489A3260F", currentActivityScope.ActivityId);
            }
            return(new Uri(stringBuilder.ToString()));
        }