Ejemplo n.º 1
0
        public static bool IsRemoteEnabled()
        {
            if (PSConnectionInfoSingleton.GetInstance().Type != OrganizationType.ToolOrEdge)
            {
                return(true);
            }
            if (EnvironmentAnalyzer.IsWorkGroup())
            {
                return(false);
            }
            string name   = "SOFTWARE\\Microsoft\\ExchangeServer\\v15\\AdminTools";
            bool   result = true;

            try
            {
                using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(name))
                {
                    if (registryKey != null)
                    {
                        object value = registryKey.GetValue("EMC.RemotePowerShellEnabled");
                        if (value != null && string.Equals("false", value.ToString(), StringComparison.OrdinalIgnoreCase))
                        {
                            result = false;
                        }
                    }
                }
            }
            catch (SecurityException)
            {
            }
            catch (UnauthorizedAccessException)
            {
            }
            return(result);
        }
 private void EnsureADSettingsEnforced()
 {
     if (this["ADServerSettings"] == null && !EnvironmentAnalyzer.IsWorkGroup())
     {
         this.waitHandle.WaitOne();
     }
 }
Ejemplo n.º 3
0
 internal override bool HasViewPermissionForPage(string pageName)
 {
     if (EnvironmentAnalyzer.IsWorkGroup() || !base.ProfileBuilder.CanEnableUICustomization())
     {
         return(true);
     }
     if (this.pageToReaderTaskMapping.ContainsKey(pageName))
     {
         return((from c in this.readerTaskProfileList
                 where this.pageToReaderTaskMapping[pageName].Contains(c.Name)
                 select c).Any((ReaderTaskProfile c) => c.HasPermission()));
     }
     return(true);
 }
 public RunspaceServerSettingsPresentationObject CreateRunspaceServerSettingsObject()
 {
     if (EnvironmentAnalyzer.IsWorkGroup() || OrganizationType.Cloud == PSConnectionInfoSingleton.GetInstance().Type || this.ADServerSettings == null)
     {
         return(null);
     }
     if (this.ADServerSettings != null)
     {
         lock (this.syncRoot)
         {
             return(this.ADServerSettings.Clone() as RunspaceServerSettingsPresentationObject);
         }
     }
     return(null);
 }
        internal void EnforceADSettings()
        {
            ExTraceGlobals.ProgramFlowTracer.TraceFunction <ExchangeADServerSettings>(0L, "-->ExchangeSystemManagerSettings.EnforceAdSettings: {0}", this);
            if (this["ADServerSettings"] == null && !EnvironmentAnalyzer.IsWorkGroup() && OrganizationType.Cloud != PSConnectionInfoSingleton.GetInstance().Type)
            {
                try
                {
                    try
                    {
                        using (MonadConnection monadConnection = new MonadConnection("timeout=30", new CommandInteractionHandler(), null, PSConnectionInfoSingleton.GetInstance().GetMonadConnectionInfo()))
                        {
                            monadConnection.Open();
                            LoggableMonadCommand loggableMonadCommand = new LoggableMonadCommand("Get-ADServerSettingsForLogonUser", monadConnection);
                            object[]             array = loggableMonadCommand.Execute();
                            if (array != null && array.Length > 0)
                            {
                                RunspaceServerSettingsPresentationObject runspaceServerSettingsPresentationObject = array[0] as RunspaceServerSettingsPresentationObject;
                                this.ADServerSettings              = runspaceServerSettingsPresentationObject;
                                this.OrganizationalUnit            = runspaceServerSettingsPresentationObject.RecipientViewRoot;
                                this.ForestViewEnabled             = runspaceServerSettingsPresentationObject.ViewEntireForest;
                                this.GlobalCatalog                 = runspaceServerSettingsPresentationObject.UserPreferredGlobalCatalog;
                                this.ConfigurationDomainController = runspaceServerSettingsPresentationObject.UserPreferredConfigurationDomainController;
                                if (runspaceServerSettingsPresentationObject.UserPreferredDomainControllers != null && runspaceServerSettingsPresentationObject.UserPreferredDomainControllers.Count != 0)
                                {
                                    this.DomainController = runspaceServerSettingsPresentationObject.UserPreferredDomainControllers[0];
                                }
                            }
                            else
                            {
                                this.SetDefaultSettings();
                            }
                        }
                    }
                    catch (Exception)
                    {
                        this.SetDefaultSettings();
                    }
                    goto IL_11A;
                }
                finally
                {
                    this.waitHandle.Set();
                }
            }
            this.waitHandle.Set();
IL_11A:
            ExTraceGlobals.ProgramFlowTracer.TraceFunction <ExchangeADServerSettings>(0L, "<--ExchangeSystemManagerSettings.EnforceAdSettings: {0}", this);
        }
Ejemplo n.º 6
0
        internal override bool HasPermissionForProperty(string propertyName, bool canUpdate)
        {
            if (EnvironmentAnalyzer.IsWorkGroup() || !base.ProfileBuilder.CanEnableUICustomization())
            {
                return(true);
            }
            ColumnProfile columnProfile = (from DataColumn c in base.Table.Columns
                                           where c.ColumnName == propertyName
                                           select c).First <DataColumn>().ExtendedProperties["ColumnProfile"] as ColumnProfile;
            string dataObjectName = columnProfile.DataObjectName;
            IEnumerable <ReaderTaskProfile> source = from c in this.readerTaskProfileList
                                                     where c.DataObjectName == dataObjectName
                                                     select c;
            ReaderTaskProfile readerTaskProfile = null;

            if (source.Count <ReaderTaskProfile>() > 0)
            {
                readerTaskProfile = source.First <ReaderTaskProfile>();
            }
            if (readerTaskProfile != null && !readerTaskProfile.HasPermission())
            {
                return(false);
            }
            if (canUpdate)
            {
                if (columnProfile.IgnoreChangeTracking)
                {
                    return(true);
                }
                IEnumerable <SaverTaskProfile> source2 = from c in this.saverTaskProfileList
                                                         where (c.Runner as Saver).GetConsumedDataObjectName() == dataObjectName && !string.IsNullOrEmpty(dataObjectName)
                                                         select c;
                SaverTaskProfile saverTaskProfile = null;
                if (source2.Count <SaverTaskProfile>() > 0)
                {
                    saverTaskProfile = source2.First <SaverTaskProfile>();
                }
                if (saverTaskProfile == null)
                {
                    IEnumerable <SaverTaskProfile> enumerable = from c in this.saverTaskProfileList
                                                                where (from p in c.ParameterProfileList
                                                                       where p.Reference == propertyName
                                                                       select p).Count <ParameterProfile>() > 0
                                                                select c;
                    using (IEnumerator <SaverTaskProfile> enumerator = enumerable.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            SaverTaskProfile saverTaskProfile2 = enumerator.Current;
                            if (!saverTaskProfile2.HasPermission(columnProfile.MappingProperty))
                            {
                                return(false);
                            }
                        }
                        return(true);
                    }
                }
                if (saverTaskProfile != null && !saverTaskProfile.HasPermission(columnProfile.MappingProperty))
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 7
0
 public MicrosoftExchangeSnapIn()
 {
     GC.KeepAlive(ManagementGuiSqmSession.Instance);
     base.RootNode = new ToolboxNode(EnvironmentAnalyzer.IsWorkGroup());
 }