forked from ezsystems/ezpublish-kernel
/
User.php
111 lines (96 loc) · 2.46 KB
/
User.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/**
* File containing the eZ\Publish\API\Repository\Values\User\User class.
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Publish\API\Repository\Values\User;
use eZ\Publish\API\Repository\Values\Content\Content;
/**
* This class represents a user value.
*
* @property-read string $login
* @property-read string $email
* @property-read string $passwordHash
* @property-read string $hashAlgorithm Hash algorithm used to hash the password
* @property-read bool $enabled User can not login if false
* @property-read int $maxLogin Max number of time user is allowed to login
*/
abstract class User extends Content implements UserReference
{
/**
* @var int MD5 of password, not recommended
*/
const PASSWORD_HASH_MD5_PASSWORD = 1;
/**
* @var int MD5 of user and password
*/
const PASSWORD_HASH_MD5_USER = 2;
/**
* @var int MD5 of site, user and password
*/
const PASSWORD_HASH_MD5_SITE = 3;
/**
* @var int Passwords in plaintext, should not be used for real sites
*/
const PASSWORD_HASH_PLAINTEXT = 5;
/**
* @var int Passwords in bcrypt
*/
const PASSWORD_HASH_BCRYPT = 6;
/**
* @var int Passwords hashed by PHPs default algorithm, which may change over time
*/
const PASSWORD_HASH_PHP_DEFAULT = 7;
/**
* User login.
*
* @var string
*/
protected $login;
/**
* User E-Mail address.
*
* @var string
*/
protected $email;
/**
* User password hash.
*
* @var string
*/
protected $passwordHash;
/**
* Hash algorithm used to hash the password.
*
* @var int
*/
protected $hashAlgorithm;
/**
* Flag to signal if user is enabled or not.
*
* User can not login if false
*
* @var bool
*/
protected $enabled = false;
/**
* Max number of time user is allowed to login.
*
* @todo: Not used in kernel, should probably be a number of login allowed before changing password.
* But new users gets 0 before they activate, admin has 10, and anonymous has 1000 in clean data.
*
* @var int
*/
protected $maxLogin;
/**
* The User id of the User.
*
* @return mixed
*/
public function getUserId()
{
return $this->id;
}
}