mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 10:27:33 -04:00 
			
		
		
		
	* 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
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Ninja\Datatables;
 | |
| 
 | |
| use Auth;
 | |
| use URL;
 | |
| 
 | |
| class ExpenseCategoryDatatable extends EntityDatatable
 | |
| {
 | |
|     public $entityType = ENTITY_EXPENSE_CATEGORY;
 | |
|     public $sortCol = 1;
 | |
| 
 | |
|     public function columns()
 | |
|     {
 | |
|         return [
 | |
|             [
 | |
|                 'name',
 | |
|                 function ($model) {
 | |
|                     if (Auth::user()->can('edit', [ENTITY_EXPENSE_CATEGORY, $model]))
 | |
|                         return link_to("expense_categories/{$model->public_id}/edit", $model->category)->toHtml();
 | |
|                     else
 | |
|                         return $model->category;
 | |
| 
 | |
|                 },
 | |
|             ],
 | |
|         ];
 | |
|     }
 | |
| 
 | |
|     public function actions()
 | |
|     {
 | |
|         return [
 | |
|             [
 | |
|                 trans('texts.edit_category'),
 | |
|                 function ($model) {
 | |
|                     return URL::to("expense_categories/{$model->public_id}/edit");
 | |
|                 },
 | |
|                 function ($model) {
 | |
|                     return Auth::user()->can('edit', [ENTITY_EXPENSE_CATEGORY, $model]);
 | |
|                 },
 | |
|             ],
 | |
|         ];
 | |
|     }
 | |
| }
 |