Bulk action permission check fixed.
This commit is contained in:
parent
d9e9271858
commit
2000de7b7b
@ -29,6 +29,18 @@ BulkActions extends Controller
|
|||||||
$bulk_actions = app('App\BulkActions\\' . ucfirst($group) . '\\' . ucfirst($type));
|
$bulk_actions = app('App\BulkActions\\' . ucfirst($group) . '\\' . ucfirst($type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($bulk_actions->actions[$request->get('handle')]['permission']) && !user()->can($bulk_actions->actions[$request->get('handle')]['permission'])) {
|
||||||
|
flash(trans('errors.message.403'))->error();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => false,
|
||||||
|
'redirect' => true,
|
||||||
|
'error' => true,
|
||||||
|
'data' => [],
|
||||||
|
'message' => trans('errors.message.403')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$result = $bulk_actions->{$request->get('handle')}($request);
|
$result = $bulk_actions->{$request->get('handle')}($request);
|
||||||
|
|
||||||
if (!empty($result) && ($result instanceof \Symfony\Component\HttpFoundation\BinaryFileResponse)) {
|
if (!empty($result) && ($result instanceof \Symfony\Component\HttpFoundation\BinaryFileResponse)) {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
@stack('bulk_action_row_input_start')
|
@stack('bulk_action_row_input_start')
|
||||||
@php
|
@php
|
||||||
if (is_array($path)) {
|
if (is_array($path)) {
|
||||||
$path = route('bulk-actions.action', $path);
|
$path = route('bulk-actions.action', $path);
|
||||||
} else {
|
} else {
|
||||||
$path = url('common/bulk-actions/' . $path);
|
$path = url('common/bulk-actions/' . $path);
|
||||||
}
|
}
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<div class="align-items-center d-none"
|
<div class="align-items-center d-none"
|
||||||
v-if="bulk_action.show"
|
v-if="bulk_action.show"
|
||||||
:class="[{'show': bulk_action.show}]">
|
:class="[{'show': bulk_action.show}]">
|
||||||
<div class="mr-6">
|
<div class="mr-6">
|
||||||
@ -31,12 +31,14 @@
|
|||||||
@change="onChange">
|
@change="onChange">
|
||||||
<option value="*">{{ trans_choice('bulk_actions.bulk_actions', 2) }}</option>
|
<option value="*">{{ trans_choice('bulk_actions.bulk_actions', 2) }}</option>
|
||||||
@foreach($actions as $key => $action)
|
@foreach($actions as $key => $action)
|
||||||
|
@if((!isset($action['permission'])) || (isset($action['permission']) && user()->can($action['permission'])))
|
||||||
<option
|
<option
|
||||||
value="{{ $key }}"
|
value="{{ $key }}"
|
||||||
@if(!empty($action['message']))
|
@if(!empty($action['message']))
|
||||||
data-message="{{ trans_choice($action['message'], 2, ['type' => $text]) }}"
|
data-message="{{ trans_choice($action['message'], 2, ['type' => $text]) }}"
|
||||||
@endif
|
@endif
|
||||||
>{{ trans($action['name']) }}</option>
|
>{{ trans($action['name']) }}</option>
|
||||||
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -63,9 +65,9 @@
|
|||||||
<span>{{ trans('general.clear') }}</span>
|
<span>{{ trans('general.clear') }}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<akaunting-modal
|
<akaunting-modal
|
||||||
:show="bulk_action.modal"
|
:show="bulk_action.modal"
|
||||||
:title="'{{ trans_choice('general.items', 2) }}'"
|
:title="'{{ trans_choice('general.items', 2) }}'"
|
||||||
:message="bulk_action.message"
|
:message="bulk_action.message"
|
||||||
@ -83,6 +85,6 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</akaunting-modal>
|
</akaunting-modal>
|
||||||
|
|
||||||
@stack('bulk_action_row_input_end')
|
@stack('bulk_action_row_input_end')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user