Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ FunctionsToExport = @()
CmdletsToExport="Get-Acl", "Set-Acl", "Get-PfxCertificate", "Get-Credential", "Get-ExecutionPolicy", "Set-ExecutionPolicy", "Get-AuthenticodeSignature", "Set-AuthenticodeSignature", "ConvertFrom-SecureString", "ConvertTo-SecureString", "Get-CmsMessage", "Unprotect-CmsMessage", "Protect-CmsMessage" , "New-FileCatalog" , "Test-FileCatalog"
AliasesToExport = @()
NestedModules="Microsoft.PowerShell.Security.dll"
TypesToProcess="Security.types.ps1xml"
HelpInfoURI = 'https://aka.ms/powershell73-help'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- *******************************************************************
These sample files contain type information used by the PowerShell engine.
Do not edit or change the contents of this file directly.
Please see the PowerShell documentation or type "Get-Help Update-TypeData"
for more information.

Copyright (c) Microsoft Corporation.

THIS SAMPLE CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
OF ANY KIND,WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
PURPOSE. IF THIS CODE AND INFORMATION IS MODIFIED, THE ENTIRE RISK OF USE
OR RESULTS IN CONNECTION WITH THE USE OF THIS CODE AND INFORMATION
REMAINS WITH THE USER.
******************************************************************** -->

<Types>
<Type>
<Name>System.Security.AccessControl.ObjectSecurity</Name>
<Members>
<CodeProperty>
<Name>Path</Name>
<GetCodeReference>
<TypeName>Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase</TypeName>
<MethodName>GetPath</MethodName>
</GetCodeReference>
</CodeProperty>
<CodeProperty>
<Name>Owner</Name>
<GetCodeReference>
<TypeName>Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase</TypeName>
<MethodName>GetOwner</MethodName>
</GetCodeReference>
</CodeProperty>
<CodeProperty>
<Name>Group</Name>
<GetCodeReference>
<TypeName>Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase</TypeName>
<MethodName>GetGroup</MethodName>
</GetCodeReference>
</CodeProperty>
<CodeProperty>
<Name>Access</Name>
<GetCodeReference>
<TypeName>Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase</TypeName>
<MethodName>GetAccess</MethodName>
</GetCodeReference>
</CodeProperty>
<CodeProperty>
<Name>Sddl</Name>
<GetCodeReference>
<TypeName>Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase</TypeName>
<MethodName>GetSddl</MethodName>
</GetCodeReference>
</CodeProperty>
<ScriptProperty>
<Name>AccessToString</Name>
<GetScriptBlock>
$toString = "";
$first = $true;
if ( ! $this.Access ) { return "" }
foreach($ace in $this.Access)
{
if($first)
{
$first = $false;
}
else
{
$tostring += "`n";
}
$toString += $ace.IdentityReference.ToString();
$toString += " ";
$toString += $ace.AccessControlType.ToString();
$toString += " ";
if($ace -is [System.Security.AccessControl.FileSystemAccessRule])
{
$toString += $ace.FileSystemRights.ToString();
}
elseif($ace -is [System.Security.AccessControl.RegistryAccessRule])
{
$toString += $ace.RegistryRights.ToString();
}
}
return $toString;
</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>AuditToString</Name>
<GetScriptBlock>
$toString = "";
$first = $true;
if ( ! (&amp; { Set-StrictMode -Version 1; $this.audit }) ) { return "" }
foreach($ace in (&amp; { Set-StrictMode -Version 1; $this.audit }))
{
if($first)
{
$first = $false;
}
else
{
$tostring += "`n";
}
$toString += $ace.IdentityReference.ToString();
$toString += " ";
$toString += $ace.AuditFlags.ToString();
$toString += " ";
if($ace -is [System.Security.AccessControl.FileSystemAuditRule])
{
$toString += $ace.FileSystemRights.ToString();
}
elseif($ace -is [System.Security.AccessControl.RegistryAuditRule])
{
$toString += $ace.RegistryRights.ToString();
}
}
return $toString;
</GetScriptBlock>
</ScriptProperty>
</Members>
</Type>

</Types>
146 changes: 0 additions & 146 deletions src/System.Management.Automation/engine/TypeTable_Types_Ps1Xml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4081,152 +4081,6 @@ private void Process_Types_Ps1Xml(string filePath, ConcurrentBag<string> errors)

#endregion System.Management.ManagementObject

#region System.Security.AccessControl.ObjectSecurity

typeName = @"System.Security.AccessControl.ObjectSecurity";
typeMembers = _extendedMembers.GetOrAdd(typeName, static key => new PSMemberInfoInternalCollection<PSMemberInfo>(capacity: 7));
Type securityDescriptorCommandsBaseType = TypeResolver.ResolveType("Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase", exception: out _);

// Process regular members.
newMembers.Add(@"Path");
AddMember(
errors,
typeName,
new PSCodeProperty(
@"Path",
GetMethodInfo(securityDescriptorCommandsBaseType, @"GetPath"),
setterCodeReference: null),
typeMembers,
isOverride: false);

newMembers.Add(@"Owner");
AddMember(
errors,
typeName,
new PSCodeProperty(
@"Owner",
GetMethodInfo(securityDescriptorCommandsBaseType, @"GetOwner"),
setterCodeReference: null),
typeMembers,
isOverride: false);

newMembers.Add(@"Group");
AddMember(
errors,
typeName,
new PSCodeProperty(
@"Group",
GetMethodInfo(securityDescriptorCommandsBaseType, @"GetGroup"),
setterCodeReference: null),
typeMembers,
isOverride: false);

newMembers.Add(@"Access");
AddMember(
errors,
typeName,
new PSCodeProperty(
@"Access",
GetMethodInfo(securityDescriptorCommandsBaseType, @"GetAccess"),
setterCodeReference: null),
typeMembers,
isOverride: false);

newMembers.Add(@"Sddl");
AddMember(
errors,
typeName,
new PSCodeProperty(
@"Sddl",
GetMethodInfo(securityDescriptorCommandsBaseType, @"GetSddl"),
setterCodeReference: null),
typeMembers,
isOverride: false);

newMembers.Add(@"AccessToString");
AddMember(
errors,
typeName,
new PSScriptProperty(
@"AccessToString",
GetScriptBlock(@"$toString = """";
$first = $true;
if ( ! $this.Access ) { return """" }

foreach($ace in $this.Access)
{
if($first)
{
$first = $false;
}
else
{
$tostring += ""`n"";
}

$toString += $ace.IdentityReference.ToString();
$toString += "" "";
$toString += $ace.AccessControlType.ToString();
$toString += "" "";
if($ace -is [System.Security.AccessControl.FileSystemAccessRule])
{
$toString += $ace.FileSystemRights.ToString();
}
elseif($ace -is [System.Security.AccessControl.RegistryAccessRule])
{
$toString += $ace.RegistryRights.ToString();
}
}

return $toString;"),
setterScript: null,
shouldCloneOnAccess: true),
typeMembers,
isOverride: false);

newMembers.Add(@"AuditToString");
AddMember(
errors,
typeName,
new PSScriptProperty(
@"AuditToString",
GetScriptBlock(@"$toString = """";
$first = $true;
if ( ! (& { Set-StrictMode -Version 1; $this.audit }) ) { return """" }

foreach($ace in (& { Set-StrictMode -Version 1; $this.audit }))
{
if($first)
{
$first = $false;
}
else
{
$tostring += ""`n"";
}

$toString += $ace.IdentityReference.ToString();
$toString += "" "";
$toString += $ace.AuditFlags.ToString();
$toString += "" "";
if($ace -is [System.Security.AccessControl.FileSystemAuditRule])
{
$toString += $ace.FileSystemRights.ToString();
}
elseif($ace -is [System.Security.AccessControl.RegistryAuditRule])
{
$toString += $ace.RegistryRights.ToString();
}
}

return $toString;"),
setterScript: null,
shouldCloneOnAccess: true),
typeMembers,
isOverride: false);

#endregion System.Security.AccessControl.ObjectSecurity

#region Microsoft.PowerShell.Commands.HistoryInfo

typeName = @"Microsoft.PowerShell.Commands.HistoryInfo";
Expand Down
1 change: 0 additions & 1 deletion test/powershell/Host/Startup.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Describe "Validate start of console host" -Tag CI {
'pwsh.dll'
'System.Collections.Concurrent.dll'
'System.Collections.dll'
'System.Collections.NonGeneric.dll'
'System.Collections.Specialized.dll'
'System.ComponentModel.dll'
'System.ComponentModel.Primitives.dll'
Expand Down
4 changes: 2 additions & 2 deletions test/powershell/engine/ETS/TypeTable.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Describe "Built-in type information tests" -Tag "CI" {

It "Should have correct number of built-in type items in type table" {
$expected = if ($IsWindows) {
273
} else {
272
} else {
271
}
$types.Count | Should -BeExactly $expected
}
Expand Down