Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
userpasswordtable.php
1
<?php
9
namespace
Bitrix\Main\Authentication\Internal
;
10
11
use
Bitrix\Main
;
12
use
Bitrix\Main\ORM\Query\Join
;
13
use
Bitrix\Main\ORM\Data
;
14
use
Bitrix\Main\ORM\Fields
;
15
32
class
UserPasswordTable
extends
Data\DataManager
33
{
34
use Data\Internal\DeleteByFilterTrait;
35
36
public
static
function
getTableName
()
37
{
38
return
'b_user_password'
;
39
}
40
41
public
static
function
getMap
()
42
{
43
return
[
44
(
new
Fields\IntegerField(
"ID"
))
45
->configurePrimary(
true
)
46
->configureAutocomplete(
true
),
47
48
(
new
Fields\IntegerField(
"USER_ID"
))
49
->addValidator(
new
Fields\Validators\ForeignValidator(Main\
UserTable::getEntity
()->getField(
'ID'
))),
50
51
(
new
Fields\
StringField
(
"PASSWORD"
)),
52
53
(
new
Fields\
DatetimeField
(
"DATE_CHANGE"
)),
54
55
(
new
Fields\Relations\
Reference
(
56
'USER'
,
57
Main\UserTable::class,
58
Join::on(
'this.USER_ID'
,
'ref.ID'
)
59
))->configureJoinType(
'inner'
),
60
];
61
}
62
63
public
static
function
passwordExpired
($userId, $days)
64
{
65
$date =
new
Main\Type\DateTime
();
66
$date->add(
"-{$days}D"
);
67
68
$prevPassword = static::query()
69
->where(
"USER_ID"
, $userId)
70
->where(
"DATE_CHANGE"
,
">"
, $date)
71
->setLimit(1)
72
->fetch();
73
74
return
!$prevPassword;
75
}
76
77
public
static
function
getUserPasswords
($userId, $limit)
78
{
79
return
static::query()
80
->addSelect(
"PASSWORD"
)
81
->where(
"USER_ID"
, $userId)
82
->addOrder(
"ID"
,
"DESC"
)
83
->setLimit($limit)
84
->fetchAll();
85
}
86
}
Bitrix\Main\Authentication\Internal\UserPasswordTable
Definition
userpasswordtable.php:33
Bitrix\Main\Authentication\Internal\UserPasswordTable\getMap
static getMap()
Definition
userpasswordtable.php:41
Bitrix\Main\Authentication\Internal\UserPasswordTable\getUserPasswords
static getUserPasswords($userId, $limit)
Definition
userpasswordtable.php:77
Bitrix\Main\Authentication\Internal\UserPasswordTable\passwordExpired
static passwordExpired($userId, $days)
Definition
userpasswordtable.php:63
Bitrix\Main\Authentication\Internal\UserPasswordTable\getTableName
static getTableName()
Definition
userpasswordtable.php:36
Bitrix\Main\ORM\Data\DataManager
Definition
datamanager.php:33
Bitrix\Main\ORM\Data\DataManager\getEntity
static getEntity()
Definition
datamanager.php:78
Bitrix\Main\ORM\Fields\DatetimeField
Definition
datetimefield.php:22
Bitrix\Main\ORM\Fields\Relations\Reference
Definition
reference.php:26
Bitrix\Main\ORM\Fields\StringField
Definition
stringfield.php:20
Bitrix\Main\ORM\Query\Join
Definition
join.php:19
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Main\Authentication\Internal
Definition
groupsubordinatetable.php:10
Bitrix\Main\ORM\Data
Definition
addresult.php:9
Bitrix\Main\ORM\Fields
Definition
arrayfield.php:9
Bitrix\Main
modules
main
lib
authentication
internal
userpasswordtable.php
Создано системой
1.10.0