diff --git a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs index 567e571703..e12d82c555 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs @@ -978,8 +978,8 @@ namespace System.Management.Automation internal static string SetModulePath() { string currentModulePath = GetExpandedEnvironmentVariable(Constants.PSModulePathEnvVar, EnvironmentVariableTarget.Process); - string systemWideModulePath = PowerShellConfig.Instance.GetModulePath(PowerShellConfig.PropertyScope.SystemWide); - string personalModulePath = PowerShellConfig.Instance.GetModulePath(PowerShellConfig.PropertyScope.CurrentUser); + string systemWideModulePath = PowerShellConfig.Instance.GetModulePath(PowerShellConfig.ConfigScope.SystemWide); + string personalModulePath = PowerShellConfig.Instance.GetModulePath(PowerShellConfig.ConfigScope.CurrentUser); string newModulePathString = GetModulePath(currentModulePath, systemWideModulePath, personalModulePath); diff --git a/src/System.Management.Automation/engine/PropertyAccessor.cs b/src/System.Management.Automation/engine/PropertyAccessor.cs index 743444394a..02a8e2a0be 100644 --- a/src/System.Management.Automation/engine/PropertyAccessor.cs +++ b/src/System.Management.Automation/engine/PropertyAccessor.cs @@ -16,11 +16,10 @@ namespace System.Management.Automation.Configuration #region Enums /// - /// Describes the scope of the property query. - /// SystemWide properties apply to all users. - /// CurrentUser properties apply to the current user that is impersonated. + /// SystemWide configuration applies to all users. + /// CurrentUser configuration applies to the current user. /// - internal enum PropertyScope + internal enum ConfigScope { SystemWide = 0, CurrentUser = 1 @@ -62,12 +61,12 @@ namespace System.Management.Automation.Configuration /// /// Whether this is a system-wide or per-user setting. /// Value if found, null otherwise. The behavior matches ModuleIntrinsics.GetExpandedEnvironmentVariable(). - internal string GetModulePath(PropertyScope scope) + internal string GetModulePath(ConfigScope scope) { string scopeDirectory = psHomeConfigDirectory; // Defaults to system wide. - if (PropertyScope.CurrentUser == scope) + if (ConfigScope.CurrentUser == scope) { scopeDirectory = appDataConfigDirectory; } @@ -96,13 +95,13 @@ namespace System.Management.Automation.Configuration /// Whether this is a system-wide or per-user setting. /// The shell associated with this policy. Typically, it is "Microsoft.PowerShell" /// The execution policy if found. Null otherwise. - internal string GetExecutionPolicy(PropertyScope scope, string shellId) + internal string GetExecutionPolicy(ConfigScope scope, string shellId) { string execPolicy = null; string scopeDirectory = psHomeConfigDirectory; // Defaults to system wide. - if(PropertyScope.CurrentUser == scope) + if(ConfigScope.CurrentUser == scope) { scopeDirectory = appDataConfigDirectory; } @@ -118,12 +117,12 @@ namespace System.Management.Automation.Configuration return execPolicy; } - internal void RemoveExecutionPolicy(PropertyScope scope, string shellId) + internal void RemoveExecutionPolicy(ConfigScope scope, string shellId) { string scopeDirectory = psHomeConfigDirectory; // Defaults to system wide. - if (PropertyScope.CurrentUser == scope) + if (ConfigScope.CurrentUser == scope) { scopeDirectory = appDataConfigDirectory; } @@ -133,12 +132,12 @@ namespace System.Management.Automation.Configuration RemoveValueFromFile(fileName, valueName); } - internal void SetExecutionPolicy(PropertyScope scope, string shellId, string executionPolicy) + internal void SetExecutionPolicy(ConfigScope scope, string shellId, string executionPolicy) { string scopeDirectory = psHomeConfigDirectory; // Defaults to system wide. - if (PropertyScope.CurrentUser == scope) + if (ConfigScope.CurrentUser == scope) { // Exceptions are not caught so that they will propagate to the // host for display to the user. diff --git a/src/System.Management.Automation/security/SecuritySupport.cs b/src/System.Management.Automation/security/SecuritySupport.cs index 6d12d7bc1a..ef62bbd94a 100644 --- a/src/System.Management.Automation/security/SecuritySupport.cs +++ b/src/System.Management.Automation/security/SecuritySupport.cs @@ -175,12 +175,12 @@ namespace System.Management.Automation.Internal // They want to remove it if (policy == ExecutionPolicy.Undefined) { - PowerShellConfig.Instance.RemoveExecutionPolicy(PowerShellConfig.PropertyScope.CurrentUser, shellId); + PowerShellConfig.Instance.RemoveExecutionPolicy(PowerShellConfig.ConfigScope.CurrentUser, shellId); CleanKeyParents(Registry.CurrentUser, preferenceKey); } else { - PowerShellConfig.Instance.SetExecutionPolicy(PowerShellConfig.PropertyScope.CurrentUser, shellId, executionPolicy); + PowerShellConfig.Instance.SetExecutionPolicy(PowerShellConfig.ConfigScope.CurrentUser, shellId, executionPolicy); } break; } @@ -190,12 +190,12 @@ namespace System.Management.Automation.Internal // They want to remove it if (policy == ExecutionPolicy.Undefined) { - PowerShellConfig.Instance.RemoveExecutionPolicy(PowerShellConfig.PropertyScope.SystemWide, shellId); + PowerShellConfig.Instance.RemoveExecutionPolicy(PowerShellConfig.ConfigScope.SystemWide, shellId); CleanKeyParents(Registry.LocalMachine, preferenceKey); } else { - PowerShellConfig.Instance.SetExecutionPolicy(PowerShellConfig.PropertyScope.SystemWide, shellId, executionPolicy); + PowerShellConfig.Instance.SetExecutionPolicy(PowerShellConfig.ConfigScope.SystemWide, shellId, executionPolicy); } break; } @@ -609,11 +609,11 @@ namespace System.Management.Automation.Internal { // 1: Look up the current-user preference case ExecutionPolicyScope.CurrentUser: - return PowerShellConfig.Instance.GetExecutionPolicy(PowerShellConfig.PropertyScope.CurrentUser, shellId); + return PowerShellConfig.Instance.GetExecutionPolicy(PowerShellConfig.ConfigScope.CurrentUser, shellId); // 2: Look up the system-wide preference case ExecutionPolicyScope.LocalMachine: - return PowerShellConfig.Instance.GetExecutionPolicy(PowerShellConfig.PropertyScope.SystemWide, shellId); + return PowerShellConfig.Instance.GetExecutionPolicy(PowerShellConfig.ConfigScope.SystemWide, shellId); } return null;