Forum

Ask, reply and learn. Join the community of Akaunting.

New Discussion

Role with limited view on Dashboard

Jonas Leu   ( User )

Commented 5 years ago

Hello


I would like to create a role who is not allowed to see all the Dashboard information. I can remove the permission "Read Admin Panel", but then the user is not able to login anymore. Could you please create a permission where i can limit Dashboard information as much as possible?


Thanks a lot.


Regards


 

Nasser Hassan   ( User )

Commented 4 years ago

Hi Jonas, I find a solution that helps you.  First, you need to create permission read-dashboard and choose for what roles you need, I put only for admin and manager. 


Second, you need to change the code in App\Http\Middleware\AdminMenu.php in public function handle this code 


 $menu->add([


 'url' => '/',


  'title' => trans('general.dashboard'),


  'icon' => 'fa fa-dashboard',


   'order' => 1,


    ]);


with


if($user->can('read-dashboard')) {


            $menu->add([


                'url' => '/',


                'title' => trans('general.dashboard'),


                'icon' => 'fa fa-dashboard',


                'order' => 1,


            ]);


        }. 


This code will not show the link Dashboard in the right navigation.


Third, if you want the dashboard the show different for other roles what you created, need in resource/view/common/dashboard - index.blade.php add an if statement like this :


@if($auth_user->can('read-dashboard'))


code for default dashboard


@else 


your code


@endphp


Don't need to remove Read Admin Panel.


Hope will help you))))

Please login or register to leave a response.

Showing 1 to 2 of 2 discussions