Code cleanup

This commit is contained in:
James Cole
2024-12-22 08:43:12 +01:00
parent 5751f7e5a3
commit 565bd87959
574 changed files with 4600 additions and 4604 deletions

View File

@@ -30,19 +30,16 @@ use Illuminate\Support\Facades\Log;
class AccountPolicy
{
/**
* TODO needs better authentication, also for group.
*/
public function view(User $user, Account $account): bool
{
return auth()->check() && $user->id === $account->user_id;
}
public function create(): bool
{
return auth()->check();
}
public function viewAccountBalances(User $user, Account $account): bool
{
return $this->view($user, $account);
}
/**
* Everybody can do this, but selection should limit to user.
*
@@ -65,8 +62,11 @@ class AccountPolicy
return $this->view($user, $account);
}
public function viewAccountBalances(User $user, Account $account): bool
/**
* TODO needs better authentication, also for group.
*/
public function view(User $user, Account $account): bool
{
return $this->view($user, $account);
return auth()->check() && $user->id === $account->user_id;
}
}

View File

@@ -38,6 +38,13 @@ class UserPolicy
return auth()->check() && $user->id === $account->user_id;
}
public function viewAccounts(User $user): bool
{
return true;
return auth()->check();
}
/**
* Everybody can do this, but selection should limit to user.
*
@@ -49,11 +56,4 @@ class UserPolicy
return auth()->check();
}
public function viewAccounts(User $user): bool
{
return true;
return auth()->check();
}
}