From 7f8e268ae0d69252fa10d9813da801e6959042f7 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 7 Jun 2019 23:00:25 +0200 Subject: [PATCH] Cleanup of redirect to admin interface if user is only admin and no agent or customer (only one central place). --- .../javascripts/app/controllers/dashboard.coffee | 10 ++++++++-- .../javascripts/app/controllers/default_route.coffee | 5 ----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/app/controllers/dashboard.coffee b/app/assets/javascripts/app/controllers/dashboard.coffee index 7da78d6ff..5a8de62e5 100644 --- a/app/assets/javascripts/app/controllers/dashboard.coffee +++ b/app/assets/javascripts/app/controllers/dashboard.coffee @@ -69,8 +69,14 @@ class App.Dashboard extends App.Controller show: (params) => - if @permissionCheck('ticket.customer') - @navigate '#', true + # incase of being only customer, redirect to default router + if @permissionCheck('ticket.customer') && !@permissionCheck('ticket.agent') + @navigate '#ticket/view', true + return + + # incase of being only admin, redirect to admin interface (show no empty white content page) + if !@permissionCheck('ticket.customer') && !@permissionCheck('ticket.agent') && @permissionCheck('admin') + @navigate '#manage', true return # set title diff --git a/app/assets/javascripts/app/controllers/default_route.coffee b/app/assets/javascripts/app/controllers/default_route.coffee index faeb3877f..b7a5e551b 100644 --- a/app/assets/javascripts/app/controllers/default_route.coffee +++ b/app/assets/javascripts/app/controllers/default_route.coffee @@ -17,11 +17,6 @@ class DefaultRouter extends App.Controller @navigate '#getting_started', true return - # check role - if @permissionCheck('ticket.customer') - @navigate '#ticket/view/my_tickets', true - return - if @Config.get('default_controller') @navigate @Config.get('default_controller'), true return