mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Fix for archiving API token
This commit is contained in:
parent
16aadf5615
commit
8dc1786eb2
@ -45,7 +45,7 @@ class EntityPolicy
|
||||
* @param $ownerUserId
|
||||
* @return bool
|
||||
*/
|
||||
public static function viewByOwner(User$user, $ownerUserId) {
|
||||
public static function viewByOwner(User $user, $ownerUserId) {
|
||||
return $user->hasPermission('view_all') || $user->id == $ownerUserId;
|
||||
}
|
||||
|
||||
|
@ -2,12 +2,14 @@
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
class TokenPolicy extends EntityPolicy {
|
||||
public static function edit($user, $item) {
|
||||
public static function edit(User $user, $item) {
|
||||
return $user->hasPermission('admin');
|
||||
}
|
||||
|
||||
public static function create($user) {
|
||||
public static function create(User $user) {
|
||||
return $user->hasPermission('admin');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class AuthServiceProvider extends ServiceProvider
|
||||
\App\Models\Product::class => \App\Policies\ProductPolicy::class,
|
||||
\App\Models\TaxRate::class => \App\Policies\TaxRatePolicy::class,
|
||||
\App\Models\AccountGateway::class => \App\Policies\AccountGatewayPolicy::class,
|
||||
\App\Models\Token::class => \App\Policies\TokenPolicy::class,
|
||||
\App\Models\AccountToken::class => \App\Policies\TokenPolicy::class,
|
||||
\App\Models\BankAccount::class => \App\Policies\BankAccountPolicy::class,
|
||||
\App\Models\PaymentTerm::class => \App\Policies\PaymentTermPolicy::class,
|
||||
];
|
||||
|
@ -32,7 +32,7 @@ class BaseService
|
||||
$entities = $this->getRepo()->findByPublicIdsWithTrashed($ids);
|
||||
|
||||
foreach ($entities as $entity) {
|
||||
if(Auth::user()->can('edit', $entity)){
|
||||
if (Auth::user()->can('edit', $entity)) {
|
||||
$this->getRepo()->$action($entity);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user