]> git.agnieray.net Git - galette.git/commitdiff
Non logged cannot see contributions or transactions
authorJohan Cwiklinski <johan@x-tnd.be>
Sat, 6 Nov 2021 06:11:37 +0000 (07:11 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Sun, 7 Nov 2021 05:50:39 +0000 (06:50 +0100)
galette/lib/Galette/Entity/Contribution.php
galette/lib/Galette/Entity/Transaction.php
tests/Galette/Entity/tests/units/Contribution.php
tests/GaletteTestCase.php

index 5124e047bedefa410a0ee96e6d12099ac0ba5817..4dbd782cda29dbef7f776d19d4711e8015058e05 100644 (file)
@@ -1443,6 +1443,11 @@ class Contribution
      */
     public function canShow(Login $login): bool
     {
+        //non-logged-in members cannot show contributions
+        if (!$login->isLogged()) {
+            return false;
+        }
+
         //admin and staff users can edit, as well as member itself
         if (!$this->id || $this->id && $login->id == $this->_member || $login->isAdmin() || $login->isStaff()) {
             return true;
index a98769193b8b9214c22c6da2fcc5962aeeaeda92..1150040748920fcccdfaa2a6ff07418d89e33fcb 100644 (file)
@@ -677,6 +677,11 @@ class Transaction
      */
     public function canShow(Login $login): bool
     {
+        //non-logged-in members cannot show contributions
+        if (!$login->isLogged()) {
+            return false;
+        }
+
         //admin and staff users can edit, as well as member itself
         if (!$this->id || $this->id && $login->id == $this->_member || $login->isAdmin() || $login->isStaff()) {
             return true;
index f3f2ae60dfeb6c43b256e4462411e159f56bcb25..36cc820df17c170c5a94392ba33394ae5dc011d5 100644 (file)
@@ -7,7 +7,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2017 The Galette Team
+ * Copyright © 2017-2021 The Galette Team
  *
  * This file is part of Galette (http://galette.tuxfamily.org).
  *
@@ -28,7 +28,7 @@
  * @package   GaletteTests
  *
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2017 The Galette Team
+ * @copyright 2017-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @version   SVN: $Id$
  * @link      http://galette.tuxfamily.org
@@ -46,7 +46,7 @@ use Galette\GaletteTestCase;
  * @name      Contribution
  * @package   GaletteTests
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2017 The Galette Team
+ * @copyright 2017-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.tuxfamily.org
  * @since     2017-06-11
index f7aec32434826a40b1f2988af6535223c52f36a8..e103ebb15ed456c6d2e7e637133d8a9286c960aa 100644 (file)
@@ -7,7 +7,7 @@
  *
  * PHP version 5
  *
- * Copyright © 2020 The Galette Team
+ * Copyright © 2020-2021 The Galette Team
  *
  * This file is part of Galette (http://galette.tuxfamily.org).
  *
@@ -28,7 +28,7 @@
  * @package   GaletteTests
  *
  * @author    Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2020 The Galette Team
+ * @copyright 2020-2021 The Galette Team
  * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
  * @link      http://galette.eu
  * @since     2020-12-27
 namespace Galette;
 
 use atoum;
+use Galette\Core\Db;
+use Galette\Core\History;
+use Galette\Core\I18n;
+use Galette\Core\Login;
+use Galette\Core\Preferences;
+use Galette\Entity\Adherent;
+use Galette\Entity\Contribution;
 
 /**
  * Galette tests case main class
@@ -52,17 +59,24 @@ use atoum;
  */
 abstract class GaletteTestCase extends atoum
 {
+    /** @var Db */
     protected $zdb;
     protected $members_fields;
     protected $members_fields_cats;
+    /** @var I18n */
     protected $i18n;
+    /** @var Preferences */
     protected $preferences;
     protected $session;
+    /** @var Login */
     protected $login;
+    /** @var History */
     protected $history;
     protected $logger_storage = '';
 
+    /** @var Adherent */
     protected $adh;
+    /** @var Contribution */
     protected $contrib;
     protected $adh_ids = [];
     protected $contrib_ids = [];