Completed
Push — master ( ba0ea8...c1bb75 )
by
unknown
25:13 queued 10:52
created

AfterGroupsResolvedEvent::getOriginalGroupIds()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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
18
namespace TYPO3\CMS\Core\Authentication\Event;
19
20
/**
21
 * Event fired after user groups have been resolved for a specific user
22
 */
23
final class AfterGroupsResolvedEvent
24
{
25
    private string $sourceDatabaseTable;
26
    private array $groups;
27
    private array $originalGroupIds;
28
    private array $userData;
29
30
    public function __construct(string $sourceDatabaseTable, array $groups, array $originalGroupIds, array $userData)
31
    {
32
        $this->sourceDatabaseTable = $sourceDatabaseTable;
33
        $this->groups = $groups;
34
        $this->originalGroupIds = $originalGroupIds;
35
        $this->userData = $userData;
36
    }
37
38
    /**
39
     * @return string 'be_groups' or 'fe_groups' depending on context.
40
     */
41
    public function getSourceDatabaseTable(): string
42
    {
43
        return $this->sourceDatabaseTable;
44
    }
45
46
    /**
47
     * List of group records including sub groups as resolved by core.
48
     *
49
     * Note order is important: A user with main groups "1,2", where 1 has sub group 3,
50
     * results in "3,1,2" as record list array - sub groups are listed before the group
51
     * that includes the sub group.
52
     */
53
    public function getGroups(): array
54
    {
55
        return $this->groups;
56
    }
57
58
    /**
59
     * List of group records as manipulated by the event.
60
     */
61
    public function setGroups(array $groups): void
62
    {
63
        $this->groups = $groups;
64
    }
65
66
    /**
67
     * List of group uids directly attached to the user
68
     */
69
    public function getOriginalGroupIds(): array
70
    {
71
        return $this->originalGroupIds;
72
    }
73
74
    /**
75
     * Full user record with all fields
76
     */
77
    public function getUserData(): array
78
    {
79
        return $this->userData;
80
    }
81
}
82