Skip to content

Commit 4eacc9c

Browse files
authored
Merge pull request #1389 from suraj-webkul/acl-latest
add acl quotes acl.
2 parents 00329ac + 32a1c25 commit 4eacc9c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+692
-2361
lines changed

packages/Webkul/Admin/src/Config/acl.php

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
], [
9090
'key' => 'mail.compose',
9191
'name' => 'admin::app.acl.create',
92-
'route' => ['admin.mail.index', 'admin.mail.store'],
92+
'route' => ['admin.mail.store'],
9393
'sort' => 6,
9494
], [
9595
'key' => 'mail.view',
@@ -157,6 +157,11 @@
157157
'route' => 'ui.datagrid.export',
158158
'sort' => 4,
159159
], [
160+
'key' => 'contacts.persons.view',
161+
'name' => 'admin::app.acl.view',
162+
'route' => 'admin.contacts.persons.view',
163+
'sort' => 5,
164+
],[
160165
'key' => 'contacts.organizations',
161166
'name' => 'admin::app.acl.organizations',
162167
'route' => 'admin.contacts.organizations.index',
@@ -196,6 +201,11 @@
196201
'name' => 'admin::app.acl.delete',
197202
'route' => ['admin.products.delete', 'admin.products.mass_delete'],
198203
'sort' => 3,
204+
],[
205+
'key' => 'products.view',
206+
'name' => 'admin::app.acl.view',
207+
'route' => 'admin.products.view',
208+
'sort' => 3,
199209
], [
200210
'key' => 'settings',
201211
'name' => 'admin::app.acl.settings',
@@ -396,6 +406,27 @@
396406
'name' => 'admin::app.acl.delete',
397407
'route' => 'admin.settings.workflows.delete',
398408
'sort' => 3,
409+
],
410+
[
411+
'key' => 'settings.automation.webhooks',
412+
'name' => 'admin::app.acl.webhook',
413+
'route' => 'admin.settings.webhooks.index',
414+
'sort' => 1,
415+
], [
416+
'key' => 'settings.automation.webhooks.create',
417+
'name' => 'admin::app.acl.create',
418+
'route' => ['admin.settings.webhooks.create', 'admin.settings.webhooks.store'],
419+
'sort' => 1,
420+
], [
421+
'key' => 'settings.automation.webhooks.edit',
422+
'name' => 'admin::app.acl.edit',
423+
'route' => ['admin.settings.webhooks.edit', 'admin.settings.webhooks.update'],
424+
'sort' => 2,
425+
], [
426+
'key' => 'settings.automation.webhooks.delete',
427+
'name' => 'admin::app.acl.delete',
428+
'route' => 'admin.settings.webhooks.delete',
429+
'sort' => 3,
399430
], [
400431
'key' => 'settings.other_settings',
401432
'name' => 'admin::app.acl.other-settings',

packages/Webkul/Admin/src/DataGrids/Activity/ActivityDataGrid.php

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -183,21 +183,25 @@ public function prepareColumns(): void
183183
*/
184184
public function prepareActions(): void
185185
{
186-
$this->addAction([
187-
'index' => 'edit',
188-
'icon' => 'icon-edit',
189-
'title' => trans('admin::app.activities.index.datagrid.edit'),
190-
'method' => 'GET',
191-
'url' => fn ($row) => route('admin.activities.edit', $row->id),
192-
]);
193-
194-
$this->addAction([
195-
'index' => 'delete',
196-
'icon' => 'icon-delete',
197-
'title' => trans('admin::app.activities.index.datagrid.update'),
198-
'method' => 'DELETE',
199-
'url' => fn ($row) => route('admin.activities.delete', $row->id),
200-
]);
186+
if (bouncer()->hasPermission('activities.edit')) {
187+
$this->addAction([
188+
'index' => 'edit',
189+
'icon' => 'icon-edit',
190+
'title' => trans('admin::app.activities.index.datagrid.edit'),
191+
'method' => 'GET',
192+
'url' => fn ($row) => route('admin.activities.edit', $row->id),
193+
]);
194+
}
195+
196+
if (bouncer()->hasPermission('activities.delete')) {
197+
$this->addAction([
198+
'index' => 'delete',
199+
'icon' => 'icon-delete',
200+
'title' => trans('admin::app.activities.index.datagrid.update'),
201+
'method' => 'DELETE',
202+
'url' => fn ($row) => route('admin.activities.delete', $row->id),
203+
]);
204+
}
201205
}
202206

203207
/**

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,23 @@ public function prepareColumns(): void
9292
*/
9393
public function prepareActions(): void
9494
{
95-
$this->addAction([
96-
'icon' => 'icon-edit',
97-
'title' => trans('admin::app.contacts.organizations.index.datagrid.edit'),
98-
'method' => 'GET',
99-
'url' => fn ($row) => route('admin.contacts.organizations.edit', $row->id),
100-
]);
95+
if (bouncer()->hasPermission('contacts.organizations.edit')) {
96+
$this->addAction([
97+
'icon' => 'icon-edit',
98+
'title' => trans('admin::app.contacts.organizations.index.datagrid.edit'),
99+
'method' => 'GET',
100+
'url' => fn ($row) => route('admin.contacts.organizations.edit', $row->id),
101+
]);
102+
}
101103

102-
$this->addAction([
103-
'icon' => 'icon-delete',
104-
'title' => trans('admin::app.contacts.organizations.index.datagrid.delete'),
105-
'method' => 'DELETE',
106-
'url' => fn ($row) => route('admin.contacts.organizations.delete', $row->id),
107-
]);
104+
if (bouncer()->hasPermission('contacts.organizations.delete')) {
105+
$this->addAction([
106+
'icon' => 'icon-delete',
107+
'title' => trans('admin::app.contacts.organizations.index.datagrid.delete'),
108+
'method' => 'DELETE',
109+
'url' => fn ($row) => route('admin.contacts.organizations.delete', $row->id),
110+
]);
111+
}
108112
}
109113

110114
/**

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@ public function prepareColumns(): void
129129
*/
130130
public function prepareActions(): void
131131
{
132-
$this->addAction([
133-
'icon' => 'icon-eye',
134-
'title' => trans('admin::app.contacts.persons.index.datagrid.view'),
135-
'method' => 'GET',
136-
'url' => function ($row) {
137-
return route('admin.contacts.persons.view', $row->id);
138-
},
139-
]);
132+
if (bouncer()->hasPermission('contacts.persons.view')) {
133+
$this->addAction([
134+
'icon' => 'icon-eye',
135+
'title' => trans('admin::app.contacts.persons.index.datagrid.view'),
136+
'method' => 'GET',
137+
'url' => function ($row) {
138+
return route('admin.contacts.persons.view', $row->id);
139+
},
140+
]);
141+
}
140142

141143
if (bouncer()->hasPermission('contacts.persons.edit')) {
142144
$this->addAction([

packages/Webkul/Admin/src/DataGrids/Mail/EmailDataGrid.php

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -86,35 +86,39 @@ public function prepareColumns(): void
8686
*/
8787
public function prepareActions(): void
8888
{
89-
$this->addAction([
90-
'index' => 'edit',
91-
'icon' => request('route') == 'draft'
92-
? 'icon-edit'
93-
: 'icon-eye',
94-
'title' => request('route') == 'draft'
95-
? trans('admin::app.mail.index.datagrid.edit')
96-
: trans('admin::app.mail.index.datagrid.view'),
97-
'method' => 'GET',
98-
'params' => [
99-
'type' => request('route') == 'trash'
100-
? 'delete'
101-
: 'trash',
102-
],
103-
'url' => fn ($row) => route('admin.mail.view', [request('route'), $row->id]),
104-
]);
89+
if (bouncer()->hasPermission('mail.view')) {
90+
$this->addAction([
91+
'index' => 'edit',
92+
'icon' => request('route') == 'draft'
93+
? 'icon-edit'
94+
: 'icon-eye',
95+
'title' => request('route') == 'draft'
96+
? trans('admin::app.mail.index.datagrid.edit')
97+
: trans('admin::app.mail.index.datagrid.view'),
98+
'method' => 'GET',
99+
'params' => [
100+
'type' => request('route') == 'trash'
101+
? 'delete'
102+
: 'trash',
103+
],
104+
'url' => fn ($row) => route('admin.mail.view', [request('route'), $row->id]),
105+
]);
106+
}
105107

106-
$this->addAction([
107-
'index' => 'delete',
108-
'icon' => 'icon-delete',
109-
'title' => trans('admin::app.mail.index.datagrid.delete'),
110-
'method' => 'DELETE',
111-
'params' => [
112-
'type' => request('route') == 'trash'
113-
? 'delete'
114-
: 'trash',
115-
],
116-
'url' => fn ($row) => route('admin.mail.delete', $row->id),
117-
]);
108+
if (bouncer()->hasPermission('mail.delete')) {
109+
$this->addAction([
110+
'index' => 'delete',
111+
'icon' => 'icon-delete',
112+
'title' => trans('admin::app.mail.index.datagrid.delete'),
113+
'method' => 'DELETE',
114+
'params' => [
115+
'type' => request('route') == 'trash'
116+
? 'delete'
117+
: 'trash',
118+
],
119+
'url' => fn ($row) => route('admin.mail.delete', $row->id),
120+
]);
121+
}
118122
}
119123

120124
/**

packages/Webkul/Admin/src/DataGrids/Product/ProductDataGrid.php

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -98,29 +98,35 @@ public function prepareColumns(): void
9898
*/
9999
public function prepareActions(): void
100100
{
101-
$this->addAction([
102-
'index' => 'view',
103-
'icon' => 'icon-eye',
104-
'title' => trans('admin::app.products.index.datagrid.view'),
105-
'method' => 'GET',
106-
'url' => fn ($row) => route('admin.products.view', $row->id),
107-
]);
101+
if (bouncer()->hasPermission('products.view')) {
102+
$this->addAction([
103+
'index' => 'view',
104+
'icon' => 'icon-eye',
105+
'title' => trans('admin::app.products.index.datagrid.view'),
106+
'method' => 'GET',
107+
'url' => fn ($row) => route('admin.products.view', $row->id),
108+
]);
109+
}
108110

109-
$this->addAction([
110-
'index' => 'edit',
111-
'icon' => 'icon-edit',
112-
'title' => trans('admin::app.products.index.datagrid.edit'),
113-
'method' => 'GET',
114-
'url' => fn ($row) => route('admin.products.edit', $row->id),
115-
]);
111+
if (bouncer()->hasPermission('products.edit')) {
112+
$this->addAction([
113+
'index' => 'edit',
114+
'icon' => 'icon-edit',
115+
'title' => trans('admin::app.products.index.datagrid.edit'),
116+
'method' => 'GET',
117+
'url' => fn ($row) => route('admin.products.edit', $row->id),
118+
]);
119+
}
116120

117-
$this->addAction([
118-
'index' => 'delete',
119-
'icon' => 'icon-delete',
120-
'title' => trans('admin::app.products.index.datagrid.delete'),
121-
'method' => 'DELETE',
122-
'url' => fn ($row) => route('admin.products.delete', $row->id),
123-
]);
121+
if (bouncer()->hasPermission('products.delete')) {
122+
$this->addAction([
123+
'index' => 'delete',
124+
'icon' => 'icon-delete',
125+
'title' => trans('admin::app.products.index.datagrid.delete'),
126+
'method' => 'DELETE',
127+
'url' => fn ($row) => route('admin.products.delete', $row->id),
128+
]);
129+
}
124130
}
125131

126132
/**

packages/Webkul/Admin/src/DataGrids/Quote/QuoteDataGrid.php

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -187,29 +187,35 @@ public function prepareColumns(): void
187187
*/
188188
public function prepareActions(): void
189189
{
190-
$this->addAction([
191-
'index' => 'edit',
192-
'icon' => 'icon-edit',
193-
'title' => trans('admin::app.quotes.index.datagrid.edit'),
194-
'method' => 'GET',
195-
'url' => fn ($row) => route('admin.quotes.edit', $row->id),
196-
]);
190+
if (bouncer()->hasPermission('quotes.edit')) {
191+
$this->addAction([
192+
'index' => 'edit',
193+
'icon' => 'icon-edit',
194+
'title' => trans('admin::app.quotes.index.datagrid.edit'),
195+
'method' => 'GET',
196+
'url' => fn ($row) => route('admin.quotes.edit', $row->id),
197+
]);
198+
}
197199

198-
$this->addAction([
199-
'index' => 'print',
200-
'icon' => 'icon-print',
201-
'title' => trans('admin::app.quotes.index.datagrid.print'),
202-
'method' => 'GET',
203-
'url' => fn ($row) => route('admin.quotes.print', $row->id),
204-
]);
200+
if (bouncer()->hasPermission('quotes.print')) {
201+
$this->addAction([
202+
'index' => 'print',
203+
'icon' => 'icon-print',
204+
'title' => trans('admin::app.quotes.index.datagrid.print'),
205+
'method' => 'GET',
206+
'url' => fn ($row) => route('admin.quotes.print', $row->id),
207+
]);
208+
}
205209

206-
$this->addAction([
207-
'index' => 'delete',
208-
'icon' => 'icon-delete',
209-
'title' => trans('admin::app.quotes.index.datagrid.delete'),
210-
'method' => 'DELETE',
211-
'url' => fn ($row) => route('admin.quotes.delete', $row->id),
212-
]);
210+
if (bouncer()->hasPermission('quotes.delete')) {
211+
$this->addAction([
212+
'index' => 'delete',
213+
'icon' => 'icon-delete',
214+
'title' => trans('admin::app.quotes.index.datagrid.delete'),
215+
'method' => 'DELETE',
216+
'url' => fn ($row) => route('admin.quotes.delete', $row->id),
217+
]);
218+
}
213219
}
214220

215221
/**

packages/Webkul/Admin/src/DataGrids/Settings/AttributeDataGrid.php

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,23 @@ public function prepareColumns(): void
9595
*/
9696
public function prepareActions(): void
9797
{
98-
$this->addAction([
99-
'icon' => 'icon-edit',
100-
'title' => trans('admin::app.settings.attributes.index.datagrid.edit'),
101-
'method' => 'GET',
102-
'url' => fn ($row) => route('admin.settings.attributes.edit', $row->id),
103-
]);
98+
if (bouncer()->hasPermission('settings.automation.attributes.edit')) {
99+
$this->addAction([
100+
'icon' => 'icon-edit',
101+
'title' => trans('admin::app.settings.attributes.index.datagrid.edit'),
102+
'method' => 'GET',
103+
'url' => fn ($row) => route('admin.settings.attributes.edit', $row->id),
104+
]);
105+
}
104106

105-
$this->addAction([
106-
'icon' => 'icon-delete',
107-
'title' => trans('admin::app.settings.attributes.index.datagrid.delete'),
108-
'method' => 'DELETE',
109-
'url' => fn ($row) => route('admin.settings.attributes.delete', $row->id),
110-
]);
107+
if (bouncer()->hasPermission('settings.automation.attributes.delete')) {
108+
$this->addAction([
109+
'icon' => 'icon-delete',
110+
'title' => trans('admin::app.settings.attributes.index.datagrid.delete'),
111+
'method' => 'DELETE',
112+
'url' => fn ($row) => route('admin.settings.attributes.delete', $row->id),
113+
]);
114+
}
111115
}
112116

113117
/**

0 commit comments

Comments
 (0)