diff --git a/app/controllers/registrar/dashboard_controller.rb b/app/controllers/registrar/dashboard_controller.rb deleted file mode 100644 index 2b8fd2430..000000000 --- a/app/controllers/registrar/dashboard_controller.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Registrar - class DashboardController < BaseController - authorize_resource class: false - - def show; end - end -end \ No newline at end of file diff --git a/app/controllers/registrar/sessions_controller.rb b/app/controllers/registrar/sessions_controller.rb index f9a60c6b1..8f4db9fdd 100644 --- a/app/controllers/registrar/sessions_controller.rb +++ b/app/controllers/registrar/sessions_controller.rb @@ -173,9 +173,9 @@ class Registrar def after_sign_in_path_for(_resource_or_scope) if can?(:show, :poll) - registrar_poll_path - else registrar_root_path + else + registrar_profile_path end end diff --git a/app/models/ability.rb b/app/models/ability.rb index 97086110b..8ca94d89b 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -31,8 +31,6 @@ class Ability end def epp # Registrar/api_user dynamic role - can :view, :registrar_dashboard - if @user.registrar.api_ip_white?(@ip) can :manage, :poll can :manage, Depp::Contact @@ -71,7 +69,6 @@ class Ability end def billing # Registrar/api_user dynamic role - can :view, :registrar_dashboard can(:manage, Invoice) { |i| i.buyer_id == @user.registrar_id } can :manage, :deposit can :read, AccountActivity diff --git a/app/models/api_user.rb b/app/models/api_user.rb index ae9ed0b28..a7c8c022d 100644 --- a/app/models/api_user.rb +++ b/app/models/api_user.rb @@ -31,6 +31,7 @@ class ApiUser < User SUPER = 'super' EPP = 'epp' + BILLING = 'billing' ROLES = %w(super epp billing) # should not match to admin roles diff --git a/app/views/layouts/registrar/base.html.erb b/app/views/layouts/registrar/base.html.erb index c14899418..a0a9a74e8 100644 --- a/app/views/layouts/registrar/base.html.erb +++ b/app/views/layouts/registrar/base.html.erb @@ -24,7 +24,8 @@ - <%= link_to registrar_root_path, class: 'navbar-brand' do %> + <%= link_to can?(:show, :poll) ? registrar_root_path : registrar_profile_path, + class: 'navbar-brand' do %> <%= t(:registrar_head_title) %> <% if unstable_env.present? %>
diff --git a/app/views/registrar/dashboard/show.haml b/app/views/registrar/dashboard/show.haml deleted file mode 100644 index 74a9405a6..000000000 --- a/app/views/registrar/dashboard/show.haml +++ /dev/null @@ -1,3 +0,0 @@ -.panel.panel-default - .panel-body - = t('welcome_to_eis_registrar_portal') diff --git a/config/locales/en.yml b/config/locales/en.yml index 2d5597e2c..d2af3cc01 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -717,7 +717,6 @@ en: mail_templates: Mail Templates failure: "It was not saved" contact_is_not_valid: 'Contact %{value} is not valid, please fix the invalid contact' - welcome_to_eis_registrar_portal: 'Welcome to EIS Registrar portal' next: 'Next' previous: 'Previous' personal_domain_verification_url: 'Personal domain verification url' diff --git a/config/routes.rb b/config/routes.rb index 2cb7ffb9b..24ca23055 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,7 +31,7 @@ Rails.application.routes.draw do # REGISTRAR ROUTES namespace :registrar do - root 'dashboard#show' + root 'polls#show' devise_for :users, path: '', class_name: 'ApiUser', skip: %i[sessions] diff --git a/test/system/registrar_area/protected_area_test.rb b/test/system/registrar_area/protected_area_test.rb index 1e6b4f0a0..f3ec06302 100644 --- a/test/system/registrar_area/protected_area_test.rb +++ b/test/system/registrar_area/protected_area_test.rb @@ -20,6 +20,6 @@ class RegistrarAreaProtectedAreaTest < ApplicationSystemTestCase visit new_registrar_user_session_url assert_text 'You are already signed in' - assert_current_path registrar_poll_path + assert_current_path registrar_root_path end end \ No newline at end of file diff --git a/test/system/registrar_area/sign_in/password_test.rb b/test/system/registrar_area/sign_in/password_test.rb index 162569d4d..04dffd07b 100644 --- a/test/system/registrar_area/sign_in/password_test.rb +++ b/test/system/registrar_area/sign_in/password_test.rb @@ -6,13 +6,21 @@ class RegistrarAreaPasswordSignInTest < ApplicationSystemTestCase end def test_correct_username_and_password - visit new_registrar_user_session_url - fill_in 'registrar_user_username', with: @user.username - fill_in 'registrar_user_password', with: 'testtest' - click_button 'Login' - + login_with_correct_credentials assert_text 'Log out' - assert_current_path registrar_poll_path + assert_current_path registrar_root_path + end + + def test_after_successful_sign_in_super_user_sees_service_message_list + @user.update!(roles: [ApiUser::SUPER]) + login_with_correct_credentials + assert_current_path registrar_root_path + end + + def test_after_successful_sign_in_billing_user_sees_profile + @user.update!(roles: [ApiUser::BILLING]) + login_with_correct_credentials + assert_current_path registrar_profile_path end def test_wrong_password @@ -27,13 +35,18 @@ class RegistrarAreaPasswordSignInTest < ApplicationSystemTestCase def test_inactive_user @user.update!(active: false) - - visit new_registrar_user_session_url - fill_in 'registrar_user_username', with: @user.username - fill_in 'registrar_user_password', with: 'testtest' - click_button 'Login' + login_with_correct_credentials assert_text 'User is not active' assert_current_path new_registrar_user_session_path end + + private + + def login_with_correct_credentials + visit new_registrar_user_session_url + fill_in 'registrar_user_username', with: @user.username + fill_in 'registrar_user_password', with: 'testtest' + click_button 'Login' + end end \ No newline at end of file