IMJLA / Export-Permission

Create CSV, HTML, and XML reports of permissions
MIT License
5 stars 1 forks source link

Remove Workaround for https://github.com/IMJLA/Export-Permission/issues/48 #50

Open IMJLA opened 10 months ago

IMJLA commented 10 months ago
    # Bugfix #48 https://github.com/IMJLA/Export-Permission/issues/48
    # Sending a dummy object down the line to avoid errors
    # TODO: More elegant solution needed. Downstream code should be able to handle null input.
    # TODO: Why does this suppress errors, but the object never appears in the tables?
    if ($null -eq $FilteredAccounts) {
        $FilteredAccounts = [pscustomobject]@{
            'Name'  = 'NoAccountsMatchingCriteria'
            'Group' = [pscustomobject]@{
                'IdentityReference' = '.'
                'Access'            = '.'
                'Name'              = '.'
                'Department'        = '.'
                'Title'             = '.'
            }
        }
    }

Expected Behavior

Code downstream of Get-FolderPermissionsBlock should be able to handle null input (if all accounts/objects have been filtered out by Get-FolderPermissionsBlock)

Current Behavior

Errors were being thrown (see https://github.com/IMJLA/Export-Permission/issues/48) so a dummy object was sent down the pipeline to avoid the errors. However that dummy object is unexpectedly disappearing and does not show up on the report. Besides, the dummy object is not an ideal solution anyway.

Possible Solution

Steps to Reproduce (for bugs)

Context

Your Environment