-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathLoadUserEvent.php
More file actions
104 lines (91 loc) · 2.26 KB
/
LoadUserEvent.php
File metadata and controls
104 lines (91 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
* This file is part of the LdapToolsBundle package.
*
* (c) Chad Sikorra <Chad.Sikorra@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace LdapTools\Bundle\LdapToolsBundle\Event;
use LdapTools\Bundle\LdapToolsBundle\Security\User\LdapUser;
use LdapTools\Object\LdapObject;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* Represents a User load event.
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class LoadUserEvent extends EventDispatcher
{
/**
* The event name that happens before a user is loaded from the user provider.
*/
const BEFORE = 'ldap_tools_bundle.load_user.before';
/**
* The event name that happens after a user is loaded from the user provider.
*/
const AFTER = 'ldap_tools_bundle.load_user.after';
/**
* @var string
*/
protected $username;
/**
* @var string
*/
protected $domain;
/**
* @var UserInterface|LdapUser|null
*/
protected $user;
/**
* @var LdapObject|null
*/
protected $ldapObject;
/**
* @param $username
* @param $domain
* @param UserInterface|null $user
* @param LdapObject|null $ldapObject
*/
public function __construct($username, $domain, UserInterface $user = null, LdapObject $ldapObject = null)
{
$this->username = $username;
$this->domain = $domain;
$this->user = $user;
$this->ldapObject = $ldapObject;
}
/**
* @return string
*/
public function getUsername()
{
return $this->username;
}
/**
* @return string
*/
public function getDomain()
{
return $this->domain;
}
/**
* This is only available on an AFTER load event. Otherwise it will be null.
*
* @return LdapUser|null|UserInterface
*/
public function getUser()
{
return $this->user;
}
/**
* Get the LDAP object the user was created from. This is only available on an AFTER load event.
*
* @return LdapObject|null
*/
public function getLdapObject()
{
return $this->ldapObject;
}
}