1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-15 06:25:14 +00:00

feat: location filter for global audit log (#662)

This commit is contained in:
Kyle Mendell
2025-06-19 12:12:53 -05:00
committed by GitHub
parent 481df3bcb9
commit ac5a121f66
11 changed files with 48 additions and 8 deletions

View File

@@ -150,6 +150,14 @@ func (s *AuditLogService) ListAllAuditLogs(ctx context.Context, sortedPagination
return nil, utils.PaginationResponse{}, fmt.Errorf("unsupported database dialect: %s", dialect)
}
}
if filters.Location != "" {
switch filters.Location {
case "external":
query = query.Where("country != 'Internal Network'")
case "internal":
query = query.Where("country = 'Internal Network'")
}
}
pagination, err := utils.PaginateAndSort(sortedPaginationRequest, query, &logs)
if err != nil {