WalletPolicy.php 889 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. // Copyright 2019 Hackware SpA <human@hackware.cl>
  3. // This file is part of "Hackware Web Services Wallet" and licensed under
  4. // the terms of the GNU Affero General Public License version 3, or (at your
  5. // option) a later version. You should have received a copy of this license
  6. // along with the software. If not, see <https://www.gnu.org/licenses/>.
  7. namespace Hawese\Wallet\Policies;
  8. use Hawese\Core\User;
  9. use Hawese\Wallet\Wallet;
  10. class WalletPolicy
  11. {
  12. /**
  13. * Reserved to super user
  14. */
  15. public function list(User $user): bool
  16. {
  17. return false;
  18. }
  19. /**
  20. * Reserved to super user
  21. */
  22. public function create(User $user): bool
  23. {
  24. return false;
  25. }
  26. /**
  27. * Only a wallet owner can read its wallet
  28. */
  29. public function read(User $user, Wallet $wallet): bool
  30. {
  31. return $wallet->isOwner($user);
  32. }
  33. }