class Wms include ActiveModel::Validations validates_presence_of :name attr_accessor :name def initialize(name) @name = name end # return SLD for selection def self.sld_selection(layer, filter_property, filter_values) sld = '' sld << "" sld << "#{layer.name}" sld << "" sld << "default" sld << "" filter_values.each do |value| # NOTE: use a separate rule for each value as workaround, as combined filter with does not work as expected sld << "" sld << "show-#{value}" sld << '' sld << "" sld << "#{filter_property}" sld << "#{value}" sld << "" sld << "" sld << layer.selection_symbolizer sld << "0" sld << "999999999" sld << "" end sld << "" sld << "" sld << "" sld << "" sld end def self.access_filters(ability, user, topic_name, layers) access_filters = {} unless topic_name.blank? layers.each do |layer| access_filter = ability.access_filter("WMS", topic_name, layer) unless access_filter.nil? access_filter.each do |key, value| access_filter[key] = AccessFilter.user_value(user, value) end access_filters.merge!(access_filter) end end end access_filters end end