Skip to content

Added support for audit-report in Power Commander.#371

Open
amandli-ks wants to merge 3 commits intoSDK-195-audit-report-relfrom
SDK-195-audit-report-dev
Open

Added support for audit-report in Power Commander.#371
amandli-ks wants to merge 3 commits intoSDK-195-audit-report-relfrom
SDK-195-audit-report-dev

Conversation

@amandli-ks
Copy link
Contributor

No description provided.

$auth = $enterprise.loader.Auth
}
catch {
Write-Error "Failed to retrieve audit report: $($_.Exception.Message)" -ErrorAction Stop

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct the error message here

elseif ($useRegex) {
$filter.Type = 'Regex'
$filter.Pattern = $workingPattern
try {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be combined with previous similar condition

Copy link
Contributor

@sgaddala-ks sgaddala-ks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Along with the above mentioned changes, since we are going very regex heavy here, please add timeouts for regex parsing where appropriate.

$auth = $enterprise.loader.Auth
}
catch {
Write-Error "Failed to retrieve audit report: $($_.Exception.Message)" -ErrorAction Stop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Write-Error "Failed to retrieve audit report: $($_.Exception.Message)" -ErrorAction Stop
Write-Error "Failed to load enterprise context: $($_.Exception.Message)" -ErrorAction Stop

}
}
'Exact' {
if ($value.Equals($filter.Pattern, [System.StringComparison]::OrdinalIgnoreCase)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($value.Equals($filter.Pattern, [System.StringComparison]::OrdinalIgnoreCase)) {
if ([string]::Equals($value, $filter.Pattern, [System.StringComparison]::OrdinalIgnoreCase)) {

this might be better, give it a thought

$allEvents = $rs.Events

function getEventValue([System.Collections.Generic.Dictionary[string,object]] $evt, [string] $key) {
if ($evt.ContainsKey($key) -and $null -ne $evt[$key]) { return $evt[$key].ToString() }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($evt.ContainsKey($key) -and $null -ne $evt[$key]) { return $evt[$key].ToString() }
if ($evt -is [System.Collections.IDictionary] -and $evt.ContainsKey($key) -and $null -ne $evt[$key]) { return $evt[$key].ToString() }


if ($Created) {
$predefinedFilters = @('today','yesterday','last_7_days','last_30_days','month_to_date','last_month','year_to_date','last_year')
$createdLower = $Created.ToLowerInvariant()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$createdLower = $Created.ToLowerInvariant()
$createdLower = $Created.Trim().ToLowerInvariant()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants