Skip to content

Commit

Permalink
Merge pull request #257 from looker-open-source/access-error-on-cat
Browse files Browse the repository at this point in the history
fix: continue after 403 error on dashboard cat getting alerts if user…
  • Loading branch information
drstrangelooker authored Jul 19, 2024
2 parents 057bbd4 + 5074ec3 commit 438b384
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/gzr/modules/dashboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,17 @@ def cat_dashboard(dashboard_id)
rewrite_color_palette!(o,default_colors)
end
end
alerts = search_alerts(fields: 'id,dashboard_element_id', group_by: 'dashboard', all_owners: true)
alerts = []
begin
alerts = search_alerts(fields: 'id,dashboard_element_id', group_by: 'dashboard', all_owners: true)
rescue LookerSDK::Forbidden => e
say_warning "Must be an admin user to look up all alerts"
begin
alerts = search_alerts(fields: 'id,dashboard_element_id', group_by: 'dashboard')
rescue LookerSDK::Error => e
say_warning "Error looking up alerts owned by user."
end
end
say_warning alerts if @options[:debug]
data[:dashboard_elements].each do |e|
alerts_found = alerts.select { |a| a[:dashboard_element_id] == e[:id]}
Expand Down

0 comments on commit 438b384

Please sign in to comment.