‪TYPO3CMS  11.5
BackendUserAuthenticationTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Prophecy\Argument;
21 use Prophecy\PhpUnit\ProphecyTrait;
22 use Psr\Log\NullLogger;
28 use TYPO3\CMS\Core\Database\Query\QueryBuilder;
37 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
38 
42 class ‪BackendUserAuthenticationTest extends UnitTestCase
43 {
44  use ProphecyTrait;
45 
46  protected array ‪$defaultFilePermissions = [
47  // File permissions
48  'addFile' => false,
49  'readFile' => false,
50  'writeFile' => false,
51  'copyFile' => false,
52  'moveFile' => false,
53  'renameFile' => false,
54  'deleteFile' => false,
55  // Folder permissions
56  'addFolder' => false,
57  'readFolder' => false,
58  'writeFolder' => false,
59  'copyFolder' => false,
60  'moveFolder' => false,
61  'renameFolder' => false,
62  'deleteFolder' => false,
63  'recursivedeleteFolder' => false,
64  ];
65 
66  protected function ‪setUp(): void
67  {
68  parent::setUp();
69  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '';
70  }
71 
75  protected function ‪tearDown(): void
76  {
78  parent::tearDown();
79  }
80 
82  // Tests concerning the form protection
84 
88  {
89  $connection = $this->prophesize(Connection::class);
90  $connection->delete('sys_lockedrecords', Argument::cetera())->willReturn(1);
91 
92  $connectionPool = $this->prophesize(ConnectionPool::class);
93  $connectionPool->getConnectionForTable(Argument::cetera())->willReturn($connection->reveal());
94 
95  GeneralUtility::addInstance(ConnectionPool::class, $connectionPool->reveal());
96 
97  $formProtection = $this->prophesize(BackendFormProtection::class);
98  $formProtection->clean()->shouldBeCalled();
99 
101  'default',
102  $formProtection->reveal()
103  );
104 
105  $sessionBackend = $this->prophesize(SessionBackendInterface::class);
106  $sessionBackend->remove(Argument::cetera())->willReturn(true);
107  $userSessionManager = new UserSessionManager(
108  $sessionBackend->reveal(),
109  86400,
110  new IpLocker(0, 0),
111  'BE'
112  );
113 
114  ‪$GLOBALS['BE_USER'] = $this->getMockBuilder(BackendUserAuthentication::class)->getMock();
115  ‪$GLOBALS['BE_USER']->user = [
116  'uid' => 4711,
117  ];
118  ‪$GLOBALS['BE_USER']->setLogger(new NullLogger());
119  ‪$GLOBALS['BE_USER']->initializeUserSessionManager($userSessionManager);
120 
121  $subject = $this->getMockBuilder(BackendUserAuthentication::class)
122  ->addMethods(['dummy'])
123  ->disableOriginalConstructor()
124  ->getMock();
125 
126  $subject->setLogger(new NullLogger());
127  $subject->initializeUserSessionManager($userSessionManager);
128  $subject->logoff();
129  }
130 
135  {
136  return [
137  'Only read permissions' => [
138  [
139  'addFile' => 0,
140  'readFile' => 1,
141  'writeFile' => 0,
142  'copyFile' => 0,
143  'moveFile' => 0,
144  'renameFile' => 0,
145  'deleteFile' => 0,
146  'addFolder' => 0,
147  'readFolder' => 1,
148  'copyFolder' => 0,
149  'moveFolder' => 0,
150  'renameFolder' => 0,
151  'writeFolder' => 0,
152  'deleteFolder' => 0,
153  'recursivedeleteFolder' => 0,
154  ],
155  ],
156  'Uploading allowed' => [
157  [
158  'addFile' => 1,
159  'readFile' => 1,
160  'writeFile' => 1,
161  'copyFile' => 1,
162  'moveFile' => 1,
163  'renameFile' => 1,
164  'deleteFile' => 1,
165  'addFolder' => 0,
166  'readFolder' => 1,
167  'copyFolder' => 0,
168  'moveFolder' => 0,
169  'renameFolder' => 0,
170  'writeFolder' => 0,
171  'deleteFolder' => 0,
172  'recursivedeleteFolder' => 0,
173  ],
174  ],
175  'One value is enough' => [
176  [
177  'addFile' => 1,
178  ],
179  ],
180  ];
181  }
182 
189  {
190  $subject = $this->getMockBuilder(BackendUserAuthentication::class)
191  ->onlyMethods(['isAdmin', 'getTSConfig'])
192  ->getMock();
193 
194  $subject
195  ->method('isAdmin')
196  ->willReturn(false);
197 
198  $subject->setLogger(new NullLogger());
199  $subject
200  ->method('getTSConfig')
201  ->willReturn([
202  'permissions.' => [
203  'file.' => [
204  'default.' => $userTsConfiguration,
205  ],
206  ],
207  ]);
208 
209  $expectedPermissions = array_merge($this->defaultFilePermissions, $userTsConfiguration);
210  array_walk(
211  $expectedPermissions,
212  static function (&$value) {
213  $value = (bool)$value;
214  }
215  );
216 
217  self::assertEquals($expectedPermissions, $subject->getFilePermissions());
218  }
219 
223  public function ‪getFilePermissionsFromStorageDataProvider(): array
224  {
225  $defaultPermissions = [
226  'addFile' => true,
227  'readFile' => true,
228  'writeFile' => true,
229  'copyFile' => true,
230  'moveFile' => true,
231  'renameFile' => true,
232  'deleteFile' => true,
233  'addFolder' => true,
234  'readFolder' => true,
235  'copyFolder' => true,
236  'moveFolder' => true,
237  'renameFolder' => true,
238  'writeFolder' => true,
239  'deleteFolder' => true,
240  'recursivedeleteFolder' => true,
241  ];
242 
243  return [
244  'Overwrites given storage permissions with default permissions' => [
245  $defaultPermissions,
246  1,
247  [
248  'addFile' => 0,
249  'recursivedeleteFolder' => 0,
250  ],
251  [
252  'addFile' => 0,
253  'readFile' => 1,
254  'writeFile' => 1,
255  'copyFile' => 1,
256  'moveFile' => 1,
257  'renameFile' => 1,
258  'deleteFile' => 1,
259  'addFolder' => 1,
260  'readFolder' => 1,
261  'copyFolder' => 1,
262  'moveFolder' => 1,
263  'renameFolder' => 1,
264  'writeFolder' => 1,
265  'deleteFolder' => 1,
266  'recursivedeleteFolder' => 0,
267  ],
268  ],
269  'Overwrites given storage 0 permissions with default permissions' => [
270  $defaultPermissions,
271  0,
272  [
273  'addFile' => 0,
274  'recursivedeleteFolder' => 0,
275  ],
276  [
277  'addFile' => false,
278  'readFile' => true,
279  'writeFile' => true,
280  'copyFile' => true,
281  'moveFile' => true,
282  'renameFile' => true,
283  'deleteFile' => true,
284  'addFolder' => true,
285  'readFolder' => true,
286  'copyFolder' => true,
287  'moveFolder' => true,
288  'renameFolder' => true,
289  'writeFolder' => true,
290  'deleteFolder' => true,
291  'recursivedeleteFolder' => false,
292  ],
293  ],
294  'Returns default permissions if no storage permissions are found' => [
295  $defaultPermissions,
296  1,
297  [],
298  [
299  'addFile' => true,
300  'readFile' => true,
301  'writeFile' => true,
302  'copyFile' => true,
303  'moveFile' => true,
304  'renameFile' => true,
305  'deleteFile' => true,
306  'addFolder' => true,
307  'readFolder' => true,
308  'copyFolder' => true,
309  'moveFolder' => true,
310  'renameFolder' => true,
311  'writeFolder' => true,
312  'deleteFolder' => true,
313  'recursivedeleteFolder' => true,
314  ],
315  ],
316  ];
317  }
318 
327  public function ‪getFilePermissionsFromStorageOverwritesDefaultPermissions(array $defaultPermissions, $storageUid, array $storagePermissions, array $expectedPermissions): void
328  {
329  $subject = $this->getMockBuilder(BackendUserAuthentication::class)
330  ->onlyMethods(['isAdmin', 'getFilePermissions', 'getTSConfig'])
331  ->getMock();
332  $storageMock = $this->createMock(ResourceStorage::class);
333  $storageMock->method('getUid')->willReturn($storageUid);
334 
335  $subject
336  ->method('isAdmin')
337  ->willReturn(false);
338 
339  $subject
340  ->method('getFilePermissions')
341  ->willReturn($defaultPermissions);
342 
343  $subject
344  ->method('getTSConfig')
345  ->willReturn([
346  'permissions.' => [
347  'file.' => [
348  'storage.' => [
349  $storageUid . '.' => $storagePermissions,
350  ],
351  ],
352  ],
353  ]);
354 
355  self::assertEquals($expectedPermissions, $subject->getFilePermissionsForStorage($storageMock));
356  }
357 
362  public function ‪getFilePermissionsFromStorageAlwaysReturnsDefaultPermissionsForAdmins(array $defaultPermissions, int $storageUid, array $storagePermissions): void
363  {
364  $subject = $this->getMockBuilder(BackendUserAuthentication::class)
365  ->onlyMethods(['isAdmin', 'getFilePermissions', 'getTSConfig'])
366  ->getMock();
367  $storageMock = $this->createMock(ResourceStorage::class);
368  $storageMock->method('getUid')->willReturn($storageUid);
369 
370  $subject
371  ->method('isAdmin')
372  ->willReturn(true);
373 
374  $subject
375  ->method('getFilePermissions')
376  ->willReturn($defaultPermissions);
377 
378  $subject
379  ->method('getTSConfig')
380  ->willReturn([
381  'permissions.' => [
382  'file.' => [
383  'storage.' => [
384  $storageUid . '.' => $storagePermissions,
385  ],
386  ],
387  ],
388  ]);
389 
390  self::assertEquals($defaultPermissions, $subject->getFilePermissionsForStorage($storageMock));
391  }
392 
397  {
398  return [
399  'No permission' => [
400  '',
401  [
402  'addFile' => false,
403  'readFile' => false,
404  'writeFile' => false,
405  'copyFile' => false,
406  'moveFile' => false,
407  'renameFile' => false,
408  'deleteFile' => false,
409  'addFolder' => false,
410  'readFolder' => false,
411  'copyFolder' => false,
412  'moveFolder' => false,
413  'renameFolder' => false,
414  'writeFolder' => false,
415  'deleteFolder' => false,
416  'recursivedeleteFolder' => false,
417  ],
418  ],
419  'Standard file permissions' => [
420  'addFile,readFile,writeFile,copyFile,moveFile,renameFile,deleteFile',
421  [
422  'addFile' => true,
423  'readFile' => true,
424  'writeFile' => true,
425  'copyFile' => true,
426  'moveFile' => true,
427  'renameFile' => true,
428  'deleteFile' => true,
429  'addFolder' => false,
430  'readFolder' => false,
431  'copyFolder' => false,
432  'moveFolder' => false,
433  'renameFolder' => false,
434  'writeFolder' => false,
435  'deleteFolder' => false,
436  'recursivedeleteFolder' => false,
437  ],
438  ],
439  'Standard folder permissions' => [
440  'addFolder,readFolder,moveFolder,renameFolder,writeFolder,deleteFolder',
441  [
442  'addFile' => false,
443  'readFile' => false,
444  'writeFile' => false,
445  'copyFile' => false,
446  'moveFile' => false,
447  'renameFile' => false,
448  'deleteFile' => false,
449  'addFolder' => true,
450  'readFolder' => true,
451  'writeFolder' => true,
452  'copyFolder' => false,
453  'moveFolder' => true,
454  'renameFolder' => true,
455  'deleteFolder' => true,
456  'recursivedeleteFolder' => false,
457  ],
458  ],
459  'Copy folder allowed' => [
460  'readFolder,copyFolder',
461  [
462  'addFile' => false,
463  'readFile' => false,
464  'writeFile' => false,
465  'copyFile' => false,
466  'moveFile' => false,
467  'renameFile' => false,
468  'deleteFile' => false,
469  'addFolder' => false,
470  'readFolder' => true,
471  'writeFolder' => false,
472  'copyFolder' => true,
473  'moveFolder' => false,
474  'renameFolder' => false,
475  'deleteFolder' => false,
476  'recursivedeleteFolder' => false,
477  ],
478  ],
479  'Copy folder and remove subfolders allowed' => [
480  'readFolder,copyFolder,recursivedeleteFolder',
481  [
482  'addFile' => false,
483  'readFile' => false,
484  'writeFile' => false,
485  'copyFile' => false,
486  'moveFile' => false,
487  'renameFile' => false,
488  'deleteFile' => false,
489  'addFolder' => false,
490  'readFolder' => true,
491  'writeFolder' => false,
492  'copyFolder' => true,
493  'moveFolder' => false,
494  'renameFolder' => false,
495  'deleteFolder' => false,
496  'recursivedeleteFolder' => true,
497  ],
498  ],
499  ];
500  }
501 
510  public function ‪getFilePermissionsTakesUserDefaultPermissionsFromRecordIntoAccountIfUserIsNotAdmin(string $permissionValue, array $expectedPermissions): void
511  {
512  $subject = $this->getMockBuilder(BackendUserAuthentication::class)
513  ->onlyMethods(['isAdmin', 'getTSConfig'])
514  ->getMock();
515 
516  $subject
517  ->method('isAdmin')
518  ->willReturn(false);
519 
520  $subject
521  ->method('getTSConfig')
522  ->willReturn([]);
523  $subject->groupData['file_permissions'] = $permissionValue;
524  self::assertEquals($expectedPermissions, $subject->getFilePermissions());
525  }
526 
531  {
532  $subject = $this->getMockBuilder(BackendUserAuthentication::class)
533  ->onlyMethods(['isAdmin'])
534  ->getMock();
535 
536  $subject
537  ->method('isAdmin')
538  ->willReturn(true);
539 
540  $expectedPermissions = [
541  'addFile' => true,
542  'readFile' => true,
543  'writeFile' => true,
544  'copyFile' => true,
545  'moveFile' => true,
546  'renameFile' => true,
547  'deleteFile' => true,
548  'addFolder' => true,
549  'readFolder' => true,
550  'writeFolder' => true,
551  'copyFolder' => true,
552  'moveFolder' => true,
553  'renameFolder' => true,
554  'deleteFolder' => true,
555  'recursivedeleteFolder' => true,
556  ];
557 
558  self::assertEquals($expectedPermissions, $subject->getFilePermissions());
559  }
560 
565  {
566  $subject = $this->getMockBuilder(BackendUserAuthentication::class)
567  ->onlyMethods(['getTSConfig'])
568  ->getMock();
569  $subject->method('getTSConfig')->with()->willReturn([
570  'options.' => [
571  'alertPopups' => 1,
572  ],
573  ]);
574  self::assertTrue($subject->jsConfirmation(‪JsConfirmation::TYPE_CHANGE));
575  self::assertFalse($subject->jsConfirmation(‪JsConfirmation::COPY_MOVE_PASTE));
576  }
577 
582  {
583  $subject = $this->getMockBuilder(BackendUserAuthentication::class)
584  ->onlyMethods(['getTSConfig'])
585  ->getMock();
586  $subject->method('getTSConfig')->with()->willReturn([
587  'options.' => [
588  'alertPopups' => 3,
589  ],
590  ]);
591  self::assertTrue($subject->jsConfirmation(‪JsConfirmation::TYPE_CHANGE));
592  self::assertTrue($subject->jsConfirmation(‪JsConfirmation::COPY_MOVE_PASTE));
593  }
594 
606  public function ‪jsConfirmationAllowsUnsettingBitsInValue($jsConfirmation, $typeChangeAllowed, $copyMovePasteAllowed, $deleteAllowed, $feEditAllowed, $otherAllowed): void
607  {
608  $subject = $this->getMockBuilder(BackendUserAuthentication::class)
609  ->onlyMethods(['getTSConfig'])
610  ->getMock();
611  $subject->method('getTSConfig')->with()->willReturn([
612  'options.' => [
613  'alertPopups' => $jsConfirmation,
614  ],
615  ]);
616  self::assertEquals($typeChangeAllowed, $subject->jsConfirmation(‪JsConfirmation::TYPE_CHANGE));
617  self::assertEquals($copyMovePasteAllowed, $subject->jsConfirmation(‪JsConfirmation::COPY_MOVE_PASTE));
618  self::assertEquals($deleteAllowed, $subject->jsConfirmation(‪JsConfirmation::DELETE));
619  self::assertEquals($feEditAllowed, $subject->jsConfirmation(‪JsConfirmation::FE_EDIT));
620  self::assertEquals($otherAllowed, $subject->jsConfirmation(‪JsConfirmation::OTHER));
621  }
622 
626  public function ‪jsConfirmationsWithUnsetBits(): array
627  {
628  return [
629  'All except "type change" and "copy/move/paste"' => [
630  252,
631  false,
632  false,
633  true,
634  true,
635  true,
636  ],
637  'All except "other"' => [
638  127,
639  true,
640  true,
641  true,
642  true,
643  false,
644  ],
645  ];
646  }
647 
652  {
653  $subject = $this->getMockBuilder(BackendUserAuthentication::class)
654  ->onlyMethods(['getTSConfig'])
655  ->getMock();
656  $subject->method('getTSConfig')->with()->willReturn([
657  'options.' => [
658  'alertPopups' => 0,
659  ],
660  ]);
661  self::assertFalse($subject->jsConfirmation(‪JsConfirmation::TYPE_CHANGE));
662  self::assertFalse($subject->jsConfirmation(‪JsConfirmation::COPY_MOVE_PASTE));
663  }
664 
669  {
670  $subject = $this->getMockBuilder(BackendUserAuthentication::class)
671  ->onlyMethods(['getTSConfig'])
672  ->getMock();
673 
674  self::assertTrue($subject->jsConfirmation(‪JsConfirmation::TYPE_CHANGE));
675  }
676 
688  {
689  return [
690  'for admin' => [
691  1,
692  true,
693  [],
694  ' 1=1',
695  ],
696  'for admin with groups' => [
697  11,
698  true,
699  [1, 2],
700  ' 1=1',
701  ],
702  'for user' => [
703  2,
704  false,
705  [],
706  ' ((`pages`.`perms_everybody` & 2 = 2) OR' .
707  ' ((`pages`.`perms_userid` = 123) AND (`pages`.`perms_user` & 2 = 2)))',
708  ],
709  'for user with groups' => [
710  8,
711  false,
712  [1, 2],
713  ' ((`pages`.`perms_everybody` & 8 = 8) OR' .
714  ' ((`pages`.`perms_userid` = 123) AND (`pages`.`perms_user` & 8 = 8))' .
715  ' OR ((`pages`.`perms_groupid` IN (1, 2)) AND (`pages`.`perms_group` & 8 = 8)))',
716  ],
717  ];
718  }
719 
728  public function ‪getPagePermissionsClauseWithValidUser(int $perms, bool $admin, array $groups, string $expected): void
729  {
730  // We only need to setup the mocking for the non-admin cases
731  // If this setup is done for admin cases the FIFO behavior
732  // of GeneralUtility::addInstance will influence other tests
733  // as the ConnectionPool is never used!
734  if (!$admin) {
735  $connectionProphecy = $this->prophesize(Connection::class);
736  $connectionProphecy->getDatabasePlatform()->willReturn(new MockPlatform());
737  $connectionProphecy->quoteIdentifier(Argument::cetera())->will(static function (‪$args) {
738  return '`' . str_replace('.', '`.`', ‪$args[0]) . '`';
739  });
740 
741  $queryBuilderProphecy = $this->prophesize(QueryBuilder::class);
742  $queryBuilderProphecy->expr()->willReturn(
743  new ExpressionBuilder($connectionProphecy->reveal())
744  );
745 
746  $databaseProphecy = $this->prophesize(ConnectionPool::class);
747  $databaseProphecy->getQueryBuilderForTable('pages')->willReturn($queryBuilderProphecy->reveal());
748  // Shift previously added instance
749  GeneralUtility::makeInstance(ConnectionPool::class);
750  GeneralUtility::addInstance(ConnectionPool::class, $databaseProphecy->reveal());
751  }
752 
753  $subject = $this->getMockBuilder(BackendUserAuthentication::class)
754  ->onlyMethods(['isAdmin'])
755  ->getMock();
756  $subject->setLogger(new NullLogger());
757  $subject
758  ->method('isAdmin')
759  ->willReturn($admin);
760 
761  $subject->user = ['uid' => 123];
762  $subject->userGroupsUID = $groups;
763 
764  self::assertEquals($expected, $subject->getPagePermsClause($perms));
765  }
766 
774  public function ‪checkAuthModeReturnsExpectedValue(string $theValue, string $authMode, bool $expectedResult): void
775  {
776  $subject = $this->getMockBuilder(BackendUserAuthentication::class)
777  ->disableOriginalConstructor()
778  ->onlyMethods(['isAdmin'])
779  ->getMock();
780 
781  $subject
782  ->method('isAdmin')
783  ->willReturn(false);
784 
785  $subject->groupData['explicit_allowdeny'] =
786  'dummytable:dummyfield:explicitly_allowed_value:ALLOW,'
787  . 'dummytable:dummyfield:explicitly_denied_value:DENY';
788 
789  $result = $subject->checkAuthMode('dummytable', 'dummyfield', $theValue, $authMode);
790  self::assertEquals($expectedResult, $result);
791  }
792 
793  public function ‪checkAuthModeReturnsExpectedValueDataProvider(): array
794  {
795  return [
796  'explicit allow, not allowed value' => [
797  'non_allowed_field',
798  'explicitAllow',
799  false,
800  ],
801  'explicit allow, allowed value' => [
802  'explicitly_allowed_value',
803  'explicitAllow',
804  true,
805  ],
806  'explicit deny, not denied value' => [
807  'non_denied_field',
808  'explicitDeny',
809  true,
810  ],
811  'explicit deny, denied value' => [
812  'explicitly_denied_value',
813  'explicitDeny',
814  false,
815  ],
816  'invalid value colon' => [
817  'containing:invalid:chars',
818  'does not matter',
819  false,
820  ],
821  'invalid value comma' => [
822  'containing,invalid,chars',
823  'does not matter',
824  false,
825  ],
826  'blank value' => [
827  '',
828  'does not matter',
829  true,
830  ],
831  'divider' => [
832  '--div--',
833  'explicitAllow',
834  true,
835  ],
836  ];
837  }
838 }
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\jsConfirmationReturnsTrueIfPassedValueEqualsConfiguration
‪jsConfirmationReturnsTrueIfPassedValueEqualsConfiguration()
Definition: BackendUserAuthenticationTest.php:563
‪TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder
Definition: ExpressionBuilder.php:36
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\getFilePermissionsTakesUserDefaultPermissionsFromRecordIntoAccountIfUserIsNotAdminDataProvider
‪array getFilePermissionsTakesUserDefaultPermissionsFromRecordIntoAccountIfUserIsNotAdminDataProvider()
Definition: BackendUserAuthenticationTest.php:395
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\checkAuthModeReturnsExpectedValueDataProvider
‪checkAuthModeReturnsExpectedValueDataProvider()
Definition: BackendUserAuthenticationTest.php:792
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\jsConfirmationAllowsUnsettingBitsInValue
‪jsConfirmationAllowsUnsettingBitsInValue($jsConfirmation, $typeChangeAllowed, $copyMovePasteAllowed, $deleteAllowed, $feEditAllowed, $otherAllowed)
Definition: BackendUserAuthenticationTest.php:605
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\jsConfirmationReturnsTrueIfConfigurationIsMissing
‪jsConfirmationReturnsTrueIfConfigurationIsMissing()
Definition: BackendUserAuthenticationTest.php:667
‪TYPO3\CMS\Core\FormProtection\FormProtectionFactory\set
‪static set($classNameOrType, AbstractFormProtection $instance)
Definition: FormProtectionFactory.php:221
‪TYPO3\CMS\Core\Tests\Unit\Authentication
Definition: AbstractUserAuthenticationTest.php:18
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\checkAuthModeReturnsExpectedValue
‪checkAuthModeReturnsExpectedValue(string $theValue, string $authMode, bool $expectedResult)
Definition: BackendUserAuthenticationTest.php:773
‪TYPO3\CMS\Core\FormProtection\BackendFormProtection
Definition: BackendFormProtection.php:75
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\getFilePermissionsTakesUserDefaultPermissionsFromRecordIntoAccountIfUserIsNotAdmin
‪getFilePermissionsTakesUserDefaultPermissionsFromRecordIntoAccountIfUserIsNotAdmin(string $permissionValue, array $expectedPermissions)
Definition: BackendUserAuthenticationTest.php:509
‪TYPO3\CMS\Core\FormProtection\FormProtectionFactory\purgeInstances
‪static purgeInstances()
Definition: FormProtectionFactory.php:231
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\getPagePermissionsClauseWithValidUser
‪getPagePermissionsClauseWithValidUser(int $perms, bool $admin, array $groups, string $expected)
Definition: BackendUserAuthenticationTest.php:727
‪TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\COPY_MOVE_PASTE
‪const COPY_MOVE_PASTE
Definition: JsConfirmation.php:34
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\getFilePermissionsTakesUserDefaultPermissionsFromTsConfigIntoAccountIfUserIsNotAdmin
‪getFilePermissionsTakesUserDefaultPermissionsFromTsConfigIntoAccountIfUserIsNotAdmin(array $userTsConfiguration)
Definition: BackendUserAuthenticationTest.php:187
‪TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\FE_EDIT
‪const FE_EDIT
Definition: JsConfirmation.php:44
‪TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\DELETE
‪const DELETE
Definition: JsConfirmation.php:39
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\setUp
‪setUp()
Definition: BackendUserAuthenticationTest.php:65
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\getFilePermissionsFromStorageOverwritesDefaultPermissions
‪getFilePermissionsFromStorageOverwritesDefaultPermissions(array $defaultPermissions, $storageUid, array $storagePermissions, array $expectedPermissions)
Definition: BackendUserAuthenticationTest.php:326
‪TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\OTHER
‪const OTHER
Definition: JsConfirmation.php:49
‪TYPO3\CMS\Core\Tests\Unit\Database\Mocks\MockPlatform
Definition: MockPlatform.php:24
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\tearDown
‪tearDown()
Definition: BackendUserAuthenticationTest.php:74
‪TYPO3\CMS\Core\Session\Backend\SessionBackendInterface
Definition: SessionBackendInterface.php:28
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\getFilePermissionsGrantsAllPermissionsToAdminUsers
‪getFilePermissionsGrantsAllPermissionsToAdminUsers()
Definition: BackendUserAuthenticationTest.php:529
‪$args
‪$args
Definition: validateRstFiles.php:214
‪TYPO3\CMS\Core\Database\Connection
Definition: Connection.php:38
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\getPagePermissionsClauseWithValidUserDataProvider
‪array getPagePermissionsClauseWithValidUserDataProvider()
Definition: BackendUserAuthenticationTest.php:686
‪TYPO3\CMS\Core\Resource\ResourceStorage
Definition: ResourceStorage.php:125
‪TYPO3\CMS\Core\FormProtection\FormProtectionFactory
Definition: FormProtectionFactory.php:48
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\getFilePermissionsTakesUserDefaultAndStoragePermissionsIntoAccountIfUserIsNotAdminDataProvider
‪array getFilePermissionsTakesUserDefaultAndStoragePermissionsIntoAccountIfUserIsNotAdminDataProvider()
Definition: BackendUserAuthenticationTest.php:133
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\getFilePermissionsFromStorageAlwaysReturnsDefaultPermissionsForAdmins
‪getFilePermissionsFromStorageAlwaysReturnsDefaultPermissionsForAdmins(array $defaultPermissions, int $storageUid, array $storagePermissions)
Definition: BackendUserAuthenticationTest.php:361
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\jsConfirmationAlwaysReturnsFalseIfNoConfirmationIsSet
‪jsConfirmationAlwaysReturnsFalseIfNoConfirmationIsSet()
Definition: BackendUserAuthenticationTest.php:650
‪TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\TYPE_CHANGE
‪const TYPE_CHANGE
Definition: JsConfirmation.php:29
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46
‪TYPO3\CMS\Core\Authentication\IpLocker
Definition: IpLocker.php:26
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\jsConfirmationAllowsSettingMultipleBitsInValue
‪jsConfirmationAllowsSettingMultipleBitsInValue()
Definition: BackendUserAuthenticationTest.php:580
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\logoffCleansFormProtectionIfBackendUserIsLoggedIn
‪logoffCleansFormProtectionIfBackendUserIsLoggedIn()
Definition: BackendUserAuthenticationTest.php:86
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\$defaultFilePermissions
‪array $defaultFilePermissions
Definition: BackendUserAuthenticationTest.php:45
‪TYPO3\CMS\Core\Type\Bitmask\JsConfirmation
Definition: JsConfirmation.php:25
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\getFilePermissionsFromStorageDataProvider
‪array getFilePermissionsFromStorageDataProvider()
Definition: BackendUserAuthenticationTest.php:222
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest
Definition: BackendUserAuthenticationTest.php:43
‪TYPO3\CMS\Core\Session\UserSessionManager
Definition: UserSessionManager.php:38
‪TYPO3\CMS\Core\Tests\Unit\Authentication\BackendUserAuthenticationTest\jsConfirmationsWithUnsetBits
‪array jsConfirmationsWithUnsetBits()
Definition: BackendUserAuthenticationTest.php:625