def authorize_demo
      if !request.xhr? && !request.get? && ( !current_user.blank? && current_user.username.downcase == 'demo' && Setting.get('demonstration_mode') == 'Y' )
        redirect_to :back, flash: { error: I18n.t('generic.demo_notification') } and return 
      end

      render :inline => 'demo' and return if params[:action] == 'save_menu' && !current_user.blank? && current_user.username.downcase == 'demo' && Setting.get('demonstration_mode') == 'Y'

    end
def authorize_demo
      if !request.xhr? && !request.get? && ( !current_user.blank? && current_user.username.downcase == 'demo' && Setting.get('demonstration_mode') == 'Y' )
        redirect_to :back, flash: { error: I18n.t('generic.demo_notification') } and return 
      end

      render :inline => 'demo' and return if params[:action] == 'save_menu' && !current_user.blank? && current_user.username.downcase == 'demo' && Setting.get('demonstration_mode') == 'Y'

    end
restricts any CRUD functions if you are logged in as the username of demo and you have demonstration mode turned on