app/helpers/configuration_helper.rb
# Returns with a hash of allowed quadicons for the current user
Returns with a hash of allowed quadicons for the current user
Returns with a hash of allowed quadicons for the current user
def allowed_quadicons
    MiqDecorator.descendants 
                .select { |klass| klass.instance_methods(false).include?(:quadicon) } 
                .sort(&method(:compare_decorator_class))
                .map do |decorator|
      klass = decorator.to_s.chomp('Decorator')
      feature = klass.constantize.model_name.singular_route_key.to_sym
      next unless role_allows?(:feature => feature, :any => true)
      [klass.demodulize.underscore.to_sym, ui_lookup(:model => klass)]
    end.compact.to_h
  end
def allowed_quadicons MiqDecorator . descendants . select { | klass | klass . instance_methods ( false ) . include? ( :quadicon ) } . sort ( & method ( :compare_decorator_class ) ) . map do | decorator | klass = decorator . to_s . chomp ( 'Decorator' ) feature = klass . constantize . model_name . singular_route_key . to_sym next unless role_allows? ( :feature => feature , :any => true ) [ klass . demodulize . underscore . to_sym , ui_lookup ( :model => klass ) ] end . compact . to_h end
Returns with a hash of allowed quadicons for the current user
Returns with a hash of allowed quadicons for the current user
# Get all the decorator classes # Select only the decorators that define a quadicon # Get the model name by removing Decorator from the class name # Retrieve the related root feature node # Just return nil if the feature is not allowed for the current user