Open pollusb opened 4 days ago
LGTM, @andreasjordan ?
Good catch. Maybe we have the same problem in other commands as well.
We do. Testing the presence of a switch parameter does not provide the right logic. Here's a list of a similar pattern:
PS C:\Users\me\Code\Repo\dbatools.fork.git\public> dir *.ps1|sls 'Test-Bound -ParameterName Exclude'
Get-DbaDbCheckConstraint.ps1:105: if ( (Test-Bound -ParameterName ExcludeSystemTable) -and
$tbl.IsSystemObject ) {
Get-DbaDbForeignKey.ps1:105: if ( (Test-Bound -ParameterName ExcludeSystemTable) -and
$tbl.IsSystemObject ) {
Get-DbaDbServiceBrokerQueue.ps1:92: if ( (Test-Bound -ParameterName ExcludeSystemQueue) -and
$queue.IsSystemObject ) {
Get-DbaDbServiceBrokerService.ps1:92: if ( (Test-Bound -ParameterName ExcludeSystemService) -and
$service.IsSystemObject ) {
Get-DbaDbStoredProcedure.ps1:185: if ( (Test-Bound -ParameterName ExcludeSystemSp) -and
$proc.IsSystemObject ) {
Get-DbaDbUdf.ps1:122: if (Test-Bound -ParameterName ExcludeSystemUdf) {
Get-DbaDbUser.ps1:124: if (Test-Bound -ParameterName ExcludeSystemUser) {
Get-DbaDbView.ps1:170: if (Test-Bound -ParameterName ExcludeSystemView) {
Get-DbaInstanceAudit.ps1:76: if (Test-Bound -ParameterName ExcludeAudit) {
Set-DbaMaxDop.ps1:153: } elseif ((Test-Bound -Not -ParameterName AllDatabases) -and (Test-Bound
-ParameterName ExcludeDatabase)) {
I would probably send PR in the same ways for these. I mean with a testing scenario. Would that be OK?
Type of Change
.\tests\manual.pester.ps1
)Purpose
Correct a logical error in Get-DbaDbUser
Approach
Commands to test
Screenshots
Learning