Skip to content

Commit 5895ddd

Browse files
Merge pull request #1257 from suraj-webkul/Issue#1196
Issue #1196 fixed.
2 parents 031491d + da5f860 commit 5895ddd

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

packages/Webkul/Admin/src/DataGrids/Contact/PersonDataGrid.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,24 @@ public function addColumns()
122122
*/
123123
public function prepareActions()
124124
{
125-
$this->addAction([
126-
'title' => trans('ui::app.datagrid.edit'),
127-
'method' => 'GET',
128-
'route' => 'admin.contacts.persons.edit',
129-
'icon' => 'pencil-icon',
130-
]);
131-
132-
$this->addAction([
133-
'title' => trans('ui::app.datagrid.delete'),
134-
'method' => 'DELETE',
135-
'route' => 'admin.contacts.persons.delete',
136-
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => trans('admin::app.contacts.persons.person')]),
137-
'icon' => 'trash-icon',
138-
]);
125+
if (bouncer()->hasPermission('contacts.persons.edit')) {
126+
$this->addAction([
127+
'title' => trans('ui::app.datagrid.edit'),
128+
'method' => 'GET',
129+
'route' => 'admin.contacts.persons.edit',
130+
'icon' => 'pencil-icon',
131+
]);
132+
}
133+
134+
if (bouncer()->hasPermission('contacts.persons.delete')) {
135+
$this->addAction([
136+
'title' => trans('ui::app.datagrid.delete'),
137+
'method' => 'DELETE',
138+
'route' => 'admin.contacts.persons.delete',
139+
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => trans('admin::app.contacts.persons.person')]),
140+
'icon' => 'trash-icon',
141+
]);
142+
}
139143
}
140144

141145
/**

packages/Webkul/Admin/src/DataGrids/Setting/UserDataGrid.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function __construct(UserRepository $userRepository)
4040
public function prepareQueryBuilder()
4141
{
4242
$queryBuilder = DB::table('users')
43+
->distinct()
4344
->addSelect(
4445
'users.id',
4546
'users.name',

packages/Webkul/Admin/src/Http/Controllers/Setting/UserController.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ class UserController extends Controller
2626
*/
2727
protected $roleRepository;
2828

29+
/**
30+
* RoleRepository object
31+
*
32+
* @var \Webkul\User\Repositories\GroupRepository
33+
*/
34+
protected $groupRepository;
35+
2936
/**
3037
* Create a new controller instance.
3138
*

0 commit comments

Comments
 (0)