This repository was archived by the owner on Nov 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInvitedUser.php
82 lines (71 loc) · 1.74 KB
/
InvitedUser.php
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
<?php
namespace Cethyworks\InvitationBundle\Model;
use Symfony\Component\Security\Core\User\UserInterface;
class InvitedUser implements UserInterface
{
const ROLE_INVITED = 'ROLE_INVITED';
/**
* @var InvitationInterface
*/
protected $invitation;
function __construct(InvitationInterface $invitation)
{
$this->invitation = $invitation;
}
/**
* Returns the roles granted to the user.
*
* @return [] The user roles
*/
public function getRoles()
{
return [self::ROLE_INVITED];
}
/**
* Returns the password used to authenticate the user.
*
* This should be the encoded password. On authentication, a plain-text
* password will be salted, encoded, and then compared to this value.
*
* @return string The password
*/
public function getPassword()
{
return '';
}
/**
* Returns the salt that was originally used to encode the password.
*
* This can return null if the password was not encoded using a salt.
*
* @return string|null The salt
*/
public function getSalt()
{
return null;
}
/**
* Returns the username used to authenticate the user.
*
*
* @return string The invitation code
*/
public function getUsername()
{
return $this->invitation->getCode();
}
/**
* Removes sensitive data from the user.
*
* This is important if, at any given point, sensitive information like
* the plain-text password is stored on this object.
*/
public function eraseCredentials(){}
/**
* @return InvitationInterface
*/
public function getInvitation()
{
return $this->invitation;
}
}