Skip to content

Commit

Permalink
Restrict the Help->Documentation screen based on RBAC rules only
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed Apr 6, 2018
1 parent 60395f1 commit 9aa897b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
5 changes: 5 additions & 0 deletions app/controllers/support_controller.rb
Expand Up @@ -4,6 +4,7 @@ class SupportController < ApplicationController
# :redirect_to => { :action => :index }

before_action :check_privileges
before_action :check_support_rbac
before_action :get_session_data
after_action :cleanup_action
after_action :set_session_data
Expand All @@ -25,6 +26,10 @@ def about

private ############################

def check_support_rbac
handle_generic_rbac(role_allows?(:feature => 'support', :any => true))
end

def get_layout
%w(about diagnostics).include?(session[:layout]) ? session[:layout] : "about"
end
Expand Down
43 changes: 20 additions & 23 deletions app/views/support/show.html.haml
Expand Up @@ -4,27 +4,24 @@
.row
- desc = ::Settings.server.custom_support_url_description
- url = ::Settings.server.custom_support_url
- cond_url = desc.present? && url.present?
- if admin_user? || (!admin_user? && cond_url)
.col-md-12
- if admin_user?
- @pdf_documents.each do |filename, title|
- docfile_path = "/doc/#{filename}.pdf"
%br
- t = (_("View the %{title} Guide") % {:title => title})
= link_to(docfile_path, :onclick => "return miqClickAndPop(this);", :title => t) do
%i.fa.fa-file-pdf-o.fa-lg
= t
%br
- if cond_url
%br
- url = "http://" + url if !url.starts_with?("http://") && !url.starts_with?("https://")
= link_to(desc, url, :onclick => "return miqClickAndPop(this);")
%br
- if admin_user?
%br
= _("For questions or problem reporting, visit ")
%a{:href => I18n.t("product.support_website").html_safe, :target => "_new"}
= I18n.t("product.support_website_text").html_safe
- cond_url = desc.present? && url.present?
.col-md-12
- @pdf_documents.each do |filename, title|
- docfile_path = "/doc/#{filename}.pdf"
%br
- t = (_("View the %{title} Guide") % {:title => title})
= link_to(docfile_path, :onclick => "return miqClickAndPop(this);", :title => t) do
%i.fa.fa-file-pdf-o.fa-lg
= t
%br
- if cond_url
%br
- url = "http://" + url if !url.starts_with?("http://") && !url.starts_with?("https://")
= link_to(desc, url, :onclick => "return miqClickAndPop(this);")
%br
%br
= _("For questions or problem reporting, visit ")
%a{:href => I18n.t("product.support_website").html_safe, :target => "_new"}
= I18n.t("product.support_website_text").html_safe

%br
%br

0 comments on commit 9aa897b

Please sign in to comment.