Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict the Help->Documentation screen based on RBAC rules only #3728

Merged
merged 1 commit into from
Apr 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/controllers/support_controller.rb
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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