cartodb/lib/carto/tracking/validators/visualization.rb

34 lines
820 B
Ruby
Raw Normal View History

2020-06-15 10:58:47 +08:00
module Carto
module Tracking
module Validators
module Visualization
module Helpers
def visualization
@format.fetch_record!(:visualization)
end
end
module Writable
include Carto::Tracking::Validators::Visualization::Helpers
def check_visualization_writable!
unless visualization.writable_by?(@reporter)
raise Carto::UnauthorizedError.new
end
end
end
module Readable
include Carto::Tracking::Validators::Visualization::Helpers
def check_visualization_readable!
unless visualization.is_accesible_by_user?(@reporter)
raise Carto::UnauthorizedError.new
end
end
end
end
end
end
end