Skip to content

Business intelligence made simple

Removed experimental query_viewable and query_editable hooks

Andrew Kane314c68cc48c4
diff --git a/app/controllers/blazer/queries_controller.rb b/app/controllers/blazer/queries_controller.rb
index dcf77d23..47eb69b6 100644
--- a/app/controllers/blazer/queries_controller.rb
+++ b/app/controllers/blazer/queries_controller.rb
@@ -84,7 +84,6 @@ module Blazer
@query = Query.find_by(id: params[:query_id]) if params[:query_id]
# use query data source when present
- # need to update viewable? logic below if this changes
data_source = @query.data_source if @query && @query.data_source
data_source ||= params[:data_source]
@data_source = Blazer.data_sources[data_source]
@@ -102,10 +101,7 @@ module Blazer
run_cohort_analysis if @cohort_analysis
- # ensure viewable
- if !(@query || Query.new(data_source: @data_source.id)).viewable?(blazer_user)
- render_forbidden
- elsif @run_id
+ if @run_id
@timestamp = blazer_params[:timestamp].to_i
@result = @data_source.run_results(@run_id)
@@ -329,10 +325,6 @@ module Blazer
def set_query
@query = Blazer::Query.find(params[:id].to_s.split("-").first)
-
- unless @query.viewable?(blazer_user)
- render_forbidden
- end
end
def render_forbidden
diff --git a/app/models/blazer/query.rb b/app/models/blazer/query.rb
index f51fd8f9..b603f2bb 100644
--- a/app/models/blazer/query.rb
+++ b/app/models/blazer/query.rb
@@ -19,19 +19,8 @@ module Blazer
name.to_s.sub(/\A[#\*]/, "").gsub(/\[.+\]/, "").strip
end
- def viewable?(user)
- if Blazer.query_viewable
- Blazer.query_viewable.call(self, user)
- else
- true
- end
- end
-
def editable?(user)
- editable = !persisted? || (name.present? && name.first != "*" && name.first != "#") || user == try(:creator)
- editable &&= viewable?(user)
- editable &&= Blazer.query_editable.call(self, user) if Blazer.query_editable
- editable
+ !persisted? || (name.present? && name.first != "*" && name.first != "#") || user == try(:creator)
end
def variables
diff --git a/lib/blazer.rb b/lib/blazer.rb
index d0d21cdd..b6f7bb81 100644
--- a/lib/blazer.rb
+++ b/lib/blazer.rb
@@ -66,8 +66,6 @@ module Blazer
attr_accessor :forecasting
attr_accessor :async
attr_accessor :images
- attr_accessor :query_viewable
- attr_accessor :query_editable
attr_accessor :override_csp
attr_accessor :slack_oauth_token
attr_accessor :slack_webhook_url