Enable users to execute workflows

This commit is contained in:
Deon George 2021-09-29 17:11:46 +10:00
parent 4243da9c32
commit 7acb9e964b
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254
7 changed files with 10 additions and 7 deletions

View File

@ -48,9 +48,9 @@ class ServicePolicy
* @param string $stage
* @return bool
*/
public function progress(User $uo,Service $so,string $stage): bool
public function progress(User $uo,Service $so,string $stage=''): bool
{
return $so->actions()->has($stage);
return $stage ? $so->actions()->has(strtoupper($stage)) : $so->actions()->count();
}
/**

View File

@ -1187,7 +1187,7 @@ class Service extends Model implements IDs
// Check service is in the resellers/customers list
case 'reseller':
case 'customer':
dd(['m'=>__METHOD__,'not written']);
return TRUE;
default:
abort(500,'Unknown role for reseller: '.$role);
@ -1201,7 +1201,7 @@ class Service extends Model implements IDs
// Check service is in the customers list
case 'customer':
dd(['m'=>__METHOD__,'not written']);
return TRUE;
default:
abort(500,'Unknown role for customer: '.$role);

View File

@ -4,6 +4,7 @@ Please order the following...
@component('mail::table')
| Service | Details |
| :---------- | :---------------- |
| Logged User | {{ Auth::user()->id }} |
| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) |
| Service ID | {!! $service->service_id_url !!} |
| Product | {{ $service->product_name }} |

View File

@ -4,6 +4,7 @@ Please cancel the following...
@component('mail::table')
| Service | Details |
| :---------- | :---------------- |
| Logged User | {{ Auth::user()->id }} |
| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) |
| Service ID | {!! $service->service_id_url !!} |
| Product | {{ $service->product_name }} |

View File

@ -4,6 +4,7 @@ Please change the following...
@component('mail::table')
| Service | Details |
| :---------- | :---------------- |
| Logged User | {{ Auth::user()->id }}
| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) |
| Service ID | {!! $service->service_id_url !!} |
| Product | {{ $service->product_name }} |

View File

@ -47,7 +47,7 @@
@endcan
</ul>
@can('update',$o)
@can('progress',$o)
<ul class="nav nav-pills ml-auto p-2">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">ACTION <span class="caret"></span></a>

View File

@ -92,10 +92,10 @@ Route::group(['middleware'=>['theme:adminlte-be','auth'],'prefix'=>'u'],function
->middleware('can:view,o');
Route::match(['get','post'],'service/{o}/cancel-request',[ServiceController::class,'cancel_request'])
->where('o','[0-9]+')
->middleware('can:update,o');
->middleware('can:progress,o,"cancel-request"');
Route::match(['get','post'],'service/{o}/change-request',[ServiceController::class,'change_request'])
->where('o','[0-9]+')
->middleware('can:update,o');
->middleware('can:progress,o,"change-request"');
Route::get('service/{o}/change/{status}',[ServiceController::class,'change'])
->where('o','[0-9]+')
->middleware('can:progress,o,status');