Build form after checking permissions
authorMatthias Schmidt <gravatronics@live.com>
Thu, 1 Oct 2020 17:15:52 +0000 (19:15 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 1 Oct 2020 17:15:52 +0000 (19:15 +0200)
Building the form after checking the permissions and the login status allows for the save usage of `WCF::getUser()` as a logged-in user.

wcfsetup/install/files/lib/form/AbstractFormBuilderForm.class.php

index 937a13e7cf508362b2c3188f0b3e67395796a8eb..7fbbacec5cc60338547933c81e6257c3a46d11b2 100644 (file)
@@ -14,7 +14,7 @@ use wcf\system\WCF;
  * Abstract implementation of a form using the form builder API.
  * 
  * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
+ * @copyright  2001-2020 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    WoltLabSuite\Core\Form
  * @since      5.2
@@ -25,7 +25,7 @@ abstract class AbstractFormBuilderForm extends AbstractForm {
         * @var IFormDocument
         */
        public $form;
-
+       
        /**
         * name of the form document class
         * @var string
@@ -234,10 +234,10 @@ abstract class AbstractFormBuilderForm extends AbstractForm {
        /**
         * @inheritDoc
         */
-       public function show() {
-               $this->buildForm();
+       public function checkPermissions() {
+               parent::checkPermissions();
                
-               parent::show();
+               $this->buildForm();
        }
        
        /**