diff --git a/app/Models/Policies/AccountPolicy.php b/app/Models/Policies/AccountPolicy.php index 76c6875..8a00a62 100644 --- a/app/Models/Policies/AccountPolicy.php +++ b/app/Models/Policies/AccountPolicy.php @@ -11,7 +11,7 @@ class AccountPolicy use HandlesAuthorization; /** - * Determine whether the user can view the service. + * Determine whether the user can view the account. * * @param User $uo * @param Account $ao @@ -25,8 +25,8 @@ class AccountPolicy // The user is the wholesaler OR $uo->isWholesaler() - // The user is the reseller - OR $uo->isReseller(); + // The user has this as one of their accounts + OR $uo->accounts->pluck('id')->contains($ao->id); } /** diff --git a/app/Models/Policies/InvoicePolicy.php b/app/Models/Policies/InvoicePolicy.php index 056750e..923f5e8 100644 --- a/app/Models/Policies/InvoicePolicy.php +++ b/app/Models/Policies/InvoicePolicy.php @@ -11,7 +11,7 @@ class InvoicePolicy use HandlesAuthorization; /** - * Determine whether the user can view the service. + * Determine whether the user can view the invoice. * * @param User $uo * @param Invoice $io @@ -25,8 +25,8 @@ class InvoicePolicy // The user is the wholesaler OR $uo->isWholesaler() - // The user is the reseller - OR $uo->isReseller(); + // The user has this as one of their accounts + OR $uo->accounts->pluck('id')->contains($io->account_id); } /** diff --git a/app/Models/Policies/ServicePolicy.php b/app/Models/Policies/ServicePolicy.php index aa55a3f..0aa7cfe 100644 --- a/app/Models/Policies/ServicePolicy.php +++ b/app/Models/Policies/ServicePolicy.php @@ -25,8 +25,8 @@ class ServicePolicy // The user is the wholesaler OR $uo->isWholesaler() - // The user is the reseller - OR $uo->isReseller(); + // The user has this as one of their accounts + OR $uo->accounts->pluck('id')->contains($so->account_id); } /** diff --git a/app/Models/Policies/UserPolicy.php b/app/Models/Policies/UserPolicy.php index c72c127..bc4ebff 100644 --- a/app/Models/Policies/UserPolicy.php +++ b/app/Models/Policies/UserPolicy.php @@ -11,7 +11,7 @@ class UserPolicy use HandlesAuthorization; /** - * Determine whether the user can view the service. + * Determine whether the user can view the user details. * * @param User $uo * @param User $o @@ -25,8 +25,8 @@ class UserPolicy // The user is the wholesaler OR $uo->isWholesaler() - // The user is the reseller - OR $uo->isReseller(); + // The user has this as one of their accounts + OR $uo->accounts->pluck('user')->pluck('id')->unique()->contains($o->id); } /** diff --git a/resources/views/theme/backend/adminlte/u/service/widgets/information.blade.php b/resources/views/theme/backend/adminlte/u/service/widgets/information.blade.php index f8c7ac3..798cb48 100644 --- a/resources/views/theme/backend/adminlte/u/service/widgets/information.blade.php +++ b/resources/views/theme/backend/adminlte/u/service/widgets/information.blade.php @@ -16,7 +16,7 @@ - +
Account{{ $o->account->sid }}{{ $o->account->sid }}
Status