From f36028e7c6fb5a5c41062b32da457ef32b55a935 Mon Sep 17 00:00:00 2001 From: Stefan Hubertus Date: Thu, 21 Sep 2023 10:04:43 +0200 Subject: [PATCH] Revert "Revert "Merge pull request #38 from karthickgandhiTV/main"" This reverts commit 4c371c8c2016d2a7748e49756231ebd5d5e84f9e. --- .github/workflows/powershell-analysis.yml | 6 +++--- .github/workflows/publish_production.yml | 2 +- .github/workflows/publish_testing.yml | 2 +- Tests/Public/Add-TeamViewerRoleToUserGroup.Tests.ps1 | 3 --- docs/Cmdlets/Private/Get-ClientId.ps1 | 1 - docs/Cmdlets/Public/Add-TeamViewerRoleToUserGroup.ps1 | 2 +- docs/Cmdlets/Public/Remove-TeamViewerPSProxy.ps1 | 1 - docs/Cmdlets/Public/Set-TeamViewerUserRole.ps1 | 1 - 8 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/powershell-analysis.yml b/.github/workflows/powershell-analysis.yml index 27cb284..cd0427c 100644 --- a/.github/workflows/powershell-analysis.yml +++ b/.github/workflows/powershell-analysis.yml @@ -22,7 +22,7 @@ jobs: name: PSScriptAnalyzer runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run PSScriptAnalyzer uses: microsoft/psscriptanalyzer-action@2044ae068e37d0161fa2127de04c19633882f061 @@ -31,8 +31,8 @@ jobs: # The below set up runs PSScriptAnalyzer to your entire repository and runs some basic security rules. path: .\ recurse: true - # Include your own basic security rules. Removing this option will run all the rules - # includeRule: '"PSAvoidGlobalAliases", "PSAvoidUsingConvertToSecureStringWithPlainText"' + # Exclude your own basic security rules. Removing this option will run all the rules + excludeRule: '"PSUseToExportFieldsInManifest","PSAvoidGlobalVars"' output: results.sarif # Upload the SARIF file generated in the previous step diff --git a/.github/workflows/publish_production.yml b/.github/workflows/publish_production.yml index ff69da6..8b5fc43 100644 --- a/.github/workflows/publish_production.yml +++ b/.github/workflows/publish_production.yml @@ -10,7 +10,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Build package shell: pwsh diff --git a/.github/workflows/publish_testing.yml b/.github/workflows/publish_testing.yml index 11b03b6..b943a5c 100644 --- a/.github/workflows/publish_testing.yml +++ b/.github/workflows/publish_testing.yml @@ -8,7 +8,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Build package shell: pwsh diff --git a/Tests/Public/Add-TeamViewerRoleToUserGroup.Tests.ps1 b/Tests/Public/Add-TeamViewerRoleToUserGroup.Tests.ps1 index 0d6dec6..d6ca0ac 100644 --- a/Tests/Public/Add-TeamViewerRoleToUserGroup.Tests.ps1 +++ b/Tests/Public/Add-TeamViewerRoleToUserGroup.Tests.ps1 @@ -9,7 +9,6 @@ BeforeAll { $null = $testUserGroup $testUserRoleId = '9b465ea2-2f75-4101-a057-58a81ed0e57b' $null = $testUserRoleId - Mock Get-TeamViewerApiUri { '//unit.test' } $mockArgs = @{} Mock Invoke-TeamViewerRestMethod { $mockArgs.Body = $Body @@ -20,10 +19,8 @@ BeforeAll { } } Describe 'Add-TeamViewerRoleToUserGroup' { - It 'Should call the correct API endpoint' { Add-TeamViewerRoleToUserGroup -ApiToken $testApiToken -UserRoleId $testUserRoleId -UserGroup $testUserGroup - Assert-MockCalled Invoke-TeamViewerRestMethod -Times 1 -Scope It -ParameterFilter { $ApiToken -eq $testApiToken -And ` $Uri -eq '//unit.test/userroles/assign/usergroup' -And ` diff --git a/docs/Cmdlets/Private/Get-ClientId.ps1 b/docs/Cmdlets/Private/Get-ClientId.ps1 index 5312ba5..eedf9f6 100644 --- a/docs/Cmdlets/Private/Get-ClientId.ps1 +++ b/docs/Cmdlets/Private/Get-ClientId.ps1 @@ -7,6 +7,5 @@ function Get-ClientId { $mainKey = Get-ItemProperty -Path 'HKLM:\Software\TeamViewer' $id = [int]$mainKey.ClientID } - return $id } diff --git a/docs/Cmdlets/Public/Add-TeamViewerRoleToUserGroup.ps1 b/docs/Cmdlets/Public/Add-TeamViewerRoleToUserGroup.ps1 index 58cd1f3..e560a5a 100644 --- a/docs/Cmdlets/Public/Add-TeamViewerRoleToUserGroup.ps1 +++ b/docs/Cmdlets/Public/Add-TeamViewerRoleToUserGroup.ps1 @@ -21,7 +21,7 @@ function Add-TeamViewerRoleToUserGroup { Begin { $RoleId = $UserRole | Resolve-TeamViewerUserRoleId - $null = $ApiToken + $null = $ApiToken $resourceUri = "$(Get-TeamViewerApiUri)/userroles/assign/usergroup" $body = @{ UserRoleId = $RoleId diff --git a/docs/Cmdlets/Public/Remove-TeamViewerPSProxy.ps1 b/docs/Cmdlets/Public/Remove-TeamViewerPSProxy.ps1 index faffda7..f053140 100644 --- a/docs/Cmdlets/Public/Remove-TeamViewerPSProxy.ps1 +++ b/docs/Cmdlets/Public/Remove-TeamViewerPSProxy.ps1 @@ -4,7 +4,6 @@ function Remove-TeamViewerPSProxy { $global:TeamViewerProxyUriRemoved = $true $global:TeamViewerProxyUriRemoved | Out-Null # https://github.com/PowerShell/PSScriptAnalyzer/issues/1472 - if($PSCmdlet.ShouldProcess($TeamViewerProxyUriRemoved,"Remove proxy for WebAPI")){ $global:TeamViewerProxyUriSet = $null $global:TeamViewerProxyUriSet | Out-Null # https://github.com/PowerShell/PSScriptAnalyzer/issues/1472 diff --git a/docs/Cmdlets/Public/Set-TeamViewerUserRole.ps1 b/docs/Cmdlets/Public/Set-TeamViewerUserRole.ps1 index aecc984..d8dbae1 100644 --- a/docs/Cmdlets/Public/Set-TeamViewerUserRole.ps1 +++ b/docs/Cmdlets/Public/Set-TeamViewerUserRole.ps1 @@ -34,7 +34,6 @@ function Set-TeamViewerUserRole { $body.Permissions = @($Permissions) } } - Process { if ($PSCmdlet.ShouldProcess($Name, 'Update User Role')) { $response = Invoke-TeamViewerRestMethod `