Fixes #3546 - Dont display profile link if user has no user_preferences.* permissions at all
This commit is contained in:
parent
992aa6d837
commit
17f457cb58
2 changed files with 24 additions and 1 deletions
|
@ -23,4 +23,4 @@ App.Config.set('profile', ProfileRouter, 'Routes')
|
|||
App.Config.set('profile/:target', ProfileRouter, 'Routes')
|
||||
|
||||
App.Config.set('Profile', { prio: 1000, name: 'Profile', target: '#profile' }, 'NavBarProfile')
|
||||
App.Config.set('Profile', { prio: 1700, parent: '#current_user', name: 'Profile', target: '#profile', translate: true }, 'NavBarRight')
|
||||
App.Config.set('Profile', { prio: 1700, parent: '#current_user', name: 'Profile', target: '#profile', permission: ['user_preferences.*'], translate: true }, 'NavBarRight')
|
||||
|
|
23
spec/system/profile_spec.rb
Normal file
23
spec/system/profile_spec.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Profile', type: :system do
|
||||
|
||||
it 'shows profile link in navigation' do
|
||||
visit 'dashboard'
|
||||
|
||||
find('a[href="#current_user"]').click
|
||||
expect(page).to have_css('.dropdown-menu > li > a[href="#profile"]')
|
||||
end
|
||||
|
||||
context 'when user is an agent with no user_preferences permission', authenticated_as: :new_user do
|
||||
let(:role) { create(:role, permissions: [Permission.find_by(name: 'ticket.agent')]) }
|
||||
let(:new_user) { create(:user, roles: [role] ) }
|
||||
|
||||
it 'does not show profile link in navigation' do
|
||||
visit 'dashboard'
|
||||
|
||||
find('a[href="#current_user"]').click
|
||||
expect(page).to have_no_css('.dropdown-menu > li > a[href="#profile"]')
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue