From 8472f275320816ca3c1db0c8f392d97292ce9b80 Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Thu, 21 Jul 2016 19:35:11 -0700 Subject: [PATCH 1/2] Updating Test-RunningAsElevated to return true on *nix and OS X. Permission models on *nix can be very complex, to the point that you could never possibly guess without simply trying what you need to try; This is totally different from Windows where you can know what you can or cannot do with/without admin rights. --- src/Modules/Shared/PowerShellGet/PSModule.psm1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Modules/Shared/PowerShellGet/PSModule.psm1 b/src/Modules/Shared/PowerShellGet/PSModule.psm1 index 68b07fe80b..6960de9040 100644 --- a/src/Modules/Shared/PowerShellGet/PSModule.psm1 +++ b/src/Modules/Shared/PowerShellGet/PSModule.psm1 @@ -16,6 +16,7 @@ $script:isNanoServer = $null -ne ('System.Runtime.Loader.AssemblyLoadContext' -a function IsWindows { $PSVariable = Get-Variable -Name IsWindows -ErrorAction Ignore; return (-not $PSVariable -or $PSVariable.Value) } function IsLinux { $PSVariable = Get-Variable -Name IsLinux -ErrorAction Ignore; return ($PSVariable -and $PSVariable.Value) } +function IsOSX { $PSVariable = Get-Variable -Name IsOSX -ErrorAction Ignore; return ($PSVariable -and $PSVariable.Value) } function IsCore { $PSVariable = Get-Variable -Name IsCore -ErrorAction Ignore; return ($PSVariable -and $PSVariable.Value) } if(IsWindows) @@ -7469,9 +7470,11 @@ function Test-RunningAsElevated $adm=[System.Security.Principal.WindowsBuiltInRole]::Administrator return $prp.IsInRole($adm) } - elseif(IsLinux) + elseif((IsLinux) -or (IsOSX)) { - return ($env:SUDO_UID -eq '1000') + # Permission models on *nix can be very complex, to the point that you could never possibly guess without simply trying what you need to try; + # This is totally different from Windows where you can know what you can or cannot do with/without admin rights. + return $true } return $false From 56196c4ad4fdaac211c9fa8fab042f2f702fcfcf Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Thu, 21 Jul 2016 20:01:03 -0700 Subject: [PATCH 2/2] Updating an error message Updating an error message --- .../Shared/PowerShellGet/PSGet.Resource.psd1 | Bin 78920 -> 79006 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/Modules/Shared/PowerShellGet/PSGet.Resource.psd1 b/src/Modules/Shared/PowerShellGet/PSGet.Resource.psd1 index 5fc17b600e3eaabd4f23e4fb60444702931817f7..9dda8e12df6659cd1f53dc135a77f53667a6550f 100644 GIT binary patch delta 51 zcmX@{f@R)ImJI^t;tCA;3`GnI43$8-6iBB4={yGY$>-l|PL~s66r1c}tF+n3T