Merge branch 'cw1998-fix/#1110'

This commit is contained in:
Dan Brown 2019-01-05 15:22:59 +00:00
commit ffceb4092e
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
2 changed files with 13 additions and 0 deletions

View File

@ -55,6 +55,9 @@
@if(signedInUser() && userCan('settings-manage')) @if(signedInUser() && userCan('settings-manage'))
<a href="{{ baseUrl('/settings') }}">@icon('settings'){{ trans('settings.settings') }}</a> <a href="{{ baseUrl('/settings') }}">@icon('settings'){{ trans('settings.settings') }}</a>
@endif @endif
@if(signedInUser() && userCan('users-manage') && !userCan('settings-manage'))
<a href="{{ baseUrl('/settings/users') }}">@icon('users'){{ trans('settings.users') }}</a>
@endif
@if(!signedInUser()) @if(!signedInUser())
@if(setting('registration-enabled', false)) @if(setting('registration-enabled', false))
<a href="{{ baseUrl("/register") }}">@icon('new-user') {{ trans('auth.sign_up') }}</a> <a href="{{ baseUrl("/register") }}">@icon('new-user') {{ trans('auth.sign_up') }}</a>

View File

@ -109,6 +109,16 @@ class RolesTest extends BrowserKitTest
->seePageIs('/settings/users'); ->seePageIs('/settings/users');
} }
public function test_manage_users_permission_shows_link_in_header_if_does_not_have_settings_manage_permision()
{
$usersLink = 'href="'.url('/settings/users') . '"';
$this->actingAs($this->user)->visit('/')->dontSee($usersLink);
$this->giveUserPermissions($this->user, ['users-manage']);
$this->actingAs($this->user)->visit('/')->see($usersLink);
$this->giveUserPermissions($this->user, ['settings-manage', 'users-manage']);
$this->actingAs($this->user)->visit('/')->dontSee($usersLink);
}
public function test_user_roles_manage_permission() public function test_user_roles_manage_permission()
{ {
$this->actingAs($this->user)->visit('/settings/roles') $this->actingAs($this->user)->visit('/settings/roles')