Hide links when no rights, dashboard redirects to domains

This commit is contained in:
Martin Lensment 2015-01-21 10:57:52 +02:00
parent 127a4fc28e
commit a4ebb24a03
3 changed files with 13 additions and 7 deletions

View file

@ -1,5 +1,7 @@
class Admin::DashboardsController < AdminController class Admin::DashboardsController < AdminController
authorize_resource class: false authorize_resource class: false
def show; end def show
redirect_to [:admin, :domains] if can? :show, Domain
end
end end

View file

@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base
def after_sign_in_path_for(_resource) def after_sign_in_path_for(_resource)
return session[:user_return_to].to_s if session[:user_return_to] && session[:user_return_to] != login_path return session[:user_return_to].to_s if session[:user_return_to] && session[:user_return_to] != login_path
admin_root_path admin_dashboard_path
end end
end end

View file

@ -20,7 +20,7 @@
%span.icon-bar %span.icon-bar
%span.icon-bar %span.icon-bar
%span.icon-bar %span.icon-bar
= link_to root_path, class: 'navbar-brand' do = link_to admin_dashboard_path, class: 'navbar-brand' do
= APP_CONFIG['app_name'] = APP_CONFIG['app_name']
- if unstable_env.present? - if unstable_env.present?
.text-center .text-center
@ -28,10 +28,14 @@
.navbar-collapse.collapse .navbar-collapse.collapse
%ul.nav.navbar-nav %ul.nav.navbar-nav
%li= link_to t('domains'), admin_domains_path - if can? :show, Domain
%li= link_to t('contacts'), admin_contacts_path %li= link_to t('domains'), admin_domains_path
%li= link_to t('registrars'), admin_registrars_path - if can? :show, Contact
%li= link_to t('keyrelays'), admin_keyrelays_path %li= link_to t('contacts'), admin_contacts_path
- if can? :show, Registrar
%li= link_to t('registrars'), admin_registrars_path
- if can? :show, Keyrelay
%li= link_to t('keyrelays'), admin_keyrelays_path
- if can?(:access, :settings_menu) - if can?(:access, :settings_menu)
%li.dropdown %li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"} %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}