mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
a9f2d0d855
* migration for new permissions schema * update permissions across data tables * refactor migrations to prevent duplicate attribute * update permissions in views * Product Permissions * permissions via controllers * Refactor to use Laravel authorization gate * Doc Blocks for EntityPolicy * check permissions conditional on create new client * Bug Fixes * Data table permissions * working on UI * settings UI/UX finalised * Datatable permissions * remove legacy permissions * permission fix for viewing client * remove all instances of viewByOwner * refactor after PR * Bug fix for Functional test and implementation of Functional tests for Permissions * fix for tests
70 lines
1.9 KiB
PHP
70 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Ninja\Datatables;
|
|
|
|
use Auth;
|
|
use URL;
|
|
use Utils;
|
|
|
|
class ProposalSnippetDatatable extends EntityDatatable
|
|
{
|
|
public $entityType = ENTITY_PROPOSAL_SNIPPET;
|
|
public $sortCol = 1;
|
|
|
|
public function columns()
|
|
{
|
|
return [
|
|
[
|
|
'name',
|
|
function ($model) {
|
|
$icon = '<i class="fa fa-' . $model->icon . '"></i> ';
|
|
|
|
if (Auth::user()->can('view', [ENTITY_PROPOSAL_SNIPPET, $model]))
|
|
return $icon . link_to("proposals/snippets/{$model->public_id}/edit", $model->name)->toHtml();
|
|
else
|
|
return $icon . $model->name;
|
|
|
|
|
|
},
|
|
],
|
|
[
|
|
'category',
|
|
function ($model) {
|
|
if (Auth::user()->can('view', [ENTITY_PROPOSAL_CATEGORY, $model]))
|
|
return link_to("proposals/categories/{$model->category_public_id}/edit", $model->category ?: ' ')->toHtml();
|
|
else
|
|
return $model->category;
|
|
|
|
},
|
|
],
|
|
[
|
|
'content',
|
|
function ($model) {
|
|
return $this->showWithTooltip(strip_tags($model->content));
|
|
},
|
|
],
|
|
[
|
|
'private_notes',
|
|
function ($model) {
|
|
return $this->showWithTooltip($model->private_notes);
|
|
},
|
|
],
|
|
];
|
|
}
|
|
|
|
public function actions()
|
|
{
|
|
return [
|
|
[
|
|
trans('texts.edit_proposal_snippet'),
|
|
function ($model) {
|
|
return URL::to("proposals/snippets/{$model->public_id}/edit");
|
|
},
|
|
function ($model) {
|
|
return Auth::user()->can('view', [ENTITY_PROPOSAL_SNIPPET, $model]);
|
|
},
|
|
],
|
|
];
|
|
}
|
|
}
|