Enable users to execute workflows
This commit is contained in:
parent
4243da9c32
commit
7acb9e964b
@ -48,9 +48,9 @@ class ServicePolicy
|
|||||||
* @param string $stage
|
* @param string $stage
|
||||||
* @return bool
|
* @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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1187,7 +1187,7 @@ class Service extends Model implements IDs
|
|||||||
// Check service is in the resellers/customers list
|
// Check service is in the resellers/customers list
|
||||||
case 'reseller':
|
case 'reseller':
|
||||||
case 'customer':
|
case 'customer':
|
||||||
dd(['m'=>__METHOD__,'not written']);
|
return TRUE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
abort(500,'Unknown role for reseller: '.$role);
|
abort(500,'Unknown role for reseller: '.$role);
|
||||||
@ -1201,7 +1201,7 @@ class Service extends Model implements IDs
|
|||||||
|
|
||||||
// Check service is in the customers list
|
// Check service is in the customers list
|
||||||
case 'customer':
|
case 'customer':
|
||||||
dd(['m'=>__METHOD__,'not written']);
|
return TRUE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
abort(500,'Unknown role for customer: '.$role);
|
abort(500,'Unknown role for customer: '.$role);
|
||||||
|
@ -4,6 +4,7 @@ Please order the following...
|
|||||||
@component('mail::table')
|
@component('mail::table')
|
||||||
| Service | Details |
|
| Service | Details |
|
||||||
| :---------- | :---------------- |
|
| :---------- | :---------------- |
|
||||||
|
| Logged User | {{ Auth::user()->id }} |
|
||||||
| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) |
|
| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) |
|
||||||
| Service ID | {!! $service->service_id_url !!} |
|
| Service ID | {!! $service->service_id_url !!} |
|
||||||
| Product | {{ $service->product_name }} |
|
| Product | {{ $service->product_name }} |
|
||||||
|
@ -4,6 +4,7 @@ Please cancel the following...
|
|||||||
@component('mail::table')
|
@component('mail::table')
|
||||||
| Service | Details |
|
| Service | Details |
|
||||||
| :---------- | :---------------- |
|
| :---------- | :---------------- |
|
||||||
|
| Logged User | {{ Auth::user()->id }} |
|
||||||
| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) |
|
| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) |
|
||||||
| Service ID | {!! $service->service_id_url !!} |
|
| Service ID | {!! $service->service_id_url !!} |
|
||||||
| Product | {{ $service->product_name }} |
|
| Product | {{ $service->product_name }} |
|
||||||
|
@ -4,6 +4,7 @@ Please change the following...
|
|||||||
@component('mail::table')
|
@component('mail::table')
|
||||||
| Service | Details |
|
| Service | Details |
|
||||||
| :---------- | :---------------- |
|
| :---------- | :---------------- |
|
||||||
|
| Logged User | {{ Auth::user()->id }}
|
||||||
| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) |
|
| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) |
|
||||||
| Service ID | {!! $service->service_id_url !!} |
|
| Service ID | {!! $service->service_id_url !!} |
|
||||||
| Product | {{ $service->product_name }} |
|
| Product | {{ $service->product_name }} |
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
@endcan
|
@endcan
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@can('update',$o)
|
@can('progress',$o)
|
||||||
<ul class="nav nav-pills ml-auto p-2">
|
<ul class="nav nav-pills ml-auto p-2">
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">ACTION <span class="caret"></span></a>
|
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">ACTION <span class="caret"></span></a>
|
||||||
|
@ -92,10 +92,10 @@ Route::group(['middleware'=>['theme:adminlte-be','auth'],'prefix'=>'u'],function
|
|||||||
->middleware('can:view,o');
|
->middleware('can:view,o');
|
||||||
Route::match(['get','post'],'service/{o}/cancel-request',[ServiceController::class,'cancel_request'])
|
Route::match(['get','post'],'service/{o}/cancel-request',[ServiceController::class,'cancel_request'])
|
||||||
->where('o','[0-9]+')
|
->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'])
|
Route::match(['get','post'],'service/{o}/change-request',[ServiceController::class,'change_request'])
|
||||||
->where('o','[0-9]+')
|
->where('o','[0-9]+')
|
||||||
->middleware('can:update,o');
|
->middleware('can:progress,o,"change-request"');
|
||||||
Route::get('service/{o}/change/{status}',[ServiceController::class,'change'])
|
Route::get('service/{o}/change/{status}',[ServiceController::class,'change'])
|
||||||
->where('o','[0-9]+')
|
->where('o','[0-9]+')
|
||||||
->middleware('can:progress,o,status');
|
->middleware('can:progress,o,status');
|
||||||
|
Loading…
Reference in New Issue
Block a user