|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Facades for Yii 2 |
|
4
|
|
|
* |
|
5
|
|
|
* Generated on Yii 2.0.12 |
|
6
|
|
|
* |
|
7
|
|
|
* @see https://github.com/sergeymakinen/yii2-facades |
|
8
|
|
|
* @copyright Copyright (c) 2016-2017 Sergey Makinen (https://makinen.ru) |
|
9
|
|
|
* @license https://github.com/sergeymakinen/yii2-facades/blob/master/LICENSE The MIT License |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace sergeymakinen\facades; |
|
13
|
|
|
|
|
14
|
|
|
/** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */ |
|
15
|
|
|
/** |
|
16
|
|
|
* Yii::$app->get('user') facade. |
|
17
|
|
|
* |
|
18
|
|
|
* Methods |
|
19
|
|
|
* |
|
20
|
|
|
* @method static \yii\base\Behavior attachBehavior(string $name, string|array|\yii\base\Behavior $behavior) Attaches a behavior to this component. |
|
21
|
|
|
* @see \yii\base\Component::attachBehavior |
|
22
|
|
|
* |
|
23
|
|
|
* @method static void attachBehaviors(array $behaviors) Attaches a list of behaviors to the component. |
|
24
|
|
|
* @see \yii\base\Component::attachBehaviors |
|
25
|
|
|
* |
|
26
|
|
|
* @method static array behaviors() Returns a list of behaviors that this component should behave as. |
|
27
|
|
|
* @see \yii\base\Component::behaviors |
|
28
|
|
|
* |
|
29
|
|
|
* @method static bool can(string $permissionName, array $params = [], bool $allowCaching = true) Checks if the user can perform the operation as specified by the given permission. |
|
30
|
|
|
* @see \yii\web\User::can |
|
31
|
|
|
* |
|
32
|
|
|
* @method static null|\yii\base\Behavior detachBehavior(string $name) Detaches a behavior from the component. |
|
33
|
|
|
* @see \yii\base\Component::detachBehavior |
|
34
|
|
|
* |
|
35
|
|
|
* @method static void detachBehaviors() Detaches all behaviors from the component. |
|
36
|
|
|
* @see \yii\base\Component::detachBehaviors |
|
37
|
|
|
* |
|
38
|
|
|
* @method static void ensureBehaviors() Makes sure that the behaviors declared in [[behaviors()]] are attached to this component. |
|
39
|
|
|
* @see \yii\base\Component::ensureBehaviors |
|
40
|
|
|
* |
|
41
|
|
|
* @method static null|\yii\base\Behavior getBehavior(string $name) Returns the named behavior object. |
|
42
|
|
|
* @see \yii\base\Component::getBehavior |
|
43
|
|
|
* |
|
44
|
|
|
* @method static \yii\base\Behavior[] getBehaviors() Returns all behaviors attached to this component. |
|
45
|
|
|
* @see \yii\base\Component::getBehaviors |
|
46
|
|
|
* |
|
47
|
|
|
* @method static string|int getId() Returns a value that uniquely represents the user. |
|
48
|
|
|
* @see \yii\web\User::getId |
|
49
|
|
|
* |
|
50
|
|
|
* @method static \yii\web\IdentityInterface|null getIdentity(bool $autoRenew = true) Returns the identity object associated with the currently logged-in user. |
|
51
|
|
|
* @see \yii\web\User::getIdentity |
|
52
|
|
|
* |
|
53
|
|
|
* @method static bool getIsGuest() Returns a value indicating whether the user is a guest (not authenticated). |
|
54
|
|
|
* @see \yii\web\User::getIsGuest |
|
55
|
|
|
* |
|
56
|
|
|
* @method static string getReturnUrl(string|array $defaultUrl = null) Returns the URL that the browser should be redirected to after successful login. |
|
57
|
|
|
* @see \yii\web\User::getReturnUrl |
|
58
|
|
|
* |
|
59
|
|
|
* @method static bool hasEventHandlers(string $name) Returns a value indicating whether there is any handler attached to the named event. |
|
60
|
|
|
* @see \yii\base\Component::hasEventHandlers |
|
61
|
|
|
* |
|
62
|
|
|
* @method static bool login(\yii\web\IdentityInterface $identity, int $duration = 0) Logs in a user. |
|
63
|
|
|
* @see \yii\web\User::login |
|
64
|
|
|
* |
|
65
|
|
|
* @method static \yii\web\IdentityInterface|null loginByAccessToken(string $token, mixed $type = null) Logs in a user by the given access token. |
|
66
|
|
|
* @see \yii\web\User::loginByAccessToken |
|
67
|
|
|
* |
|
68
|
|
|
* @method static \yii\web\Response loginRequired(bool $checkAjax = true, bool $checkAcceptHeader = true) Redirects the user browser to the login page. |
|
69
|
|
|
* @see \yii\web\User::loginRequired |
|
70
|
|
|
* |
|
71
|
|
|
* @method static bool logout(bool $destroySession = true) Logs out the current user. |
|
72
|
|
|
* @see \yii\web\User::logout |
|
73
|
|
|
* |
|
74
|
|
|
* @method static bool off(string $name, callable $handler = null) Detaches an existing event handler from this component. |
|
75
|
|
|
* @see \yii\base\Component::off |
|
76
|
|
|
* |
|
77
|
|
|
* @method static void on(string $name, callable $handler, mixed $data = null, bool $append = true) Attaches an event handler to an event. |
|
78
|
|
|
* @see \yii\base\Component::on |
|
79
|
|
|
* |
|
80
|
|
|
* @method static void setIdentity(\yii\web\IdentityInterface|null $identity) Sets the user identity object. |
|
81
|
|
|
* @see \yii\web\User::setIdentity |
|
82
|
|
|
* |
|
83
|
|
|
* @method static void setReturnUrl(string|array $url) Remembers the URL in the session so that it can be retrieved back later by [[getReturnUrl()]]. |
|
84
|
|
|
* @see \yii\web\User::setReturnUrl |
|
85
|
|
|
* |
|
86
|
|
|
* @method static void switchIdentity(\yii\web\IdentityInterface|null $identity, int $duration = 0) Switches to a new identity for the current user. |
|
87
|
|
|
* @see \yii\web\User::switchIdentity |
|
88
|
|
|
* |
|
89
|
|
|
* @method static void trigger(string $name, \yii\base\Event $event = null) Triggers an event. |
|
90
|
|
|
* @see \yii\base\Component::trigger |
|
91
|
|
|
* |
|
92
|
|
|
* Property accessors |
|
93
|
|
|
* |
|
94
|
|
|
* @method static int getAbsoluteAuthTimeout() Returns the number of seconds in which the user will be logged out automatically regardless of activity. |
|
95
|
|
|
* @see \yii\web\User::absoluteAuthTimeout |
|
96
|
|
|
* |
|
97
|
|
|
* @method static string getAbsoluteAuthTimeoutParam() Returns the session variable name used to store the value of absolute expiration timestamp of the authenticated state. |
|
98
|
|
|
* @see \yii\web\User::absoluteAuthTimeoutParam |
|
99
|
|
|
* |
|
100
|
|
|
* @method static array getAcceptableRedirectTypes() Returns MIME types for which this component should redirect to the [[loginUrl]]. |
|
101
|
|
|
* @see \yii\web\User::acceptableRedirectTypes |
|
102
|
|
|
* |
|
103
|
|
|
* @method static \yii\rbac\CheckAccessInterface getAccessChecker() Returns The access checker to use for checking access. |
|
104
|
|
|
* @see \yii\web\User::accessChecker |
|
105
|
|
|
* |
|
106
|
|
|
* @method static int getAuthTimeout() Returns the number of seconds in which the user will be logged out automatically if he remains inactive. |
|
107
|
|
|
* @see \yii\web\User::authTimeout |
|
108
|
|
|
* |
|
109
|
|
|
* @method static string getAuthTimeoutParam() Returns the session variable name used to store the value of expiration timestamp of the authenticated state. |
|
110
|
|
|
* @see \yii\web\User::authTimeoutParam |
|
111
|
|
|
* |
|
112
|
|
|
* @method static bool getAutoRenewCookie() Returns whether to automatically renew the identity cookie each time a page is requested. |
|
113
|
|
|
* @see \yii\web\User::autoRenewCookie |
|
114
|
|
|
* |
|
115
|
|
|
* @method static bool getEnableAutoLogin() Returns whether to enable cookie-based login. |
|
116
|
|
|
* @see \yii\web\User::enableAutoLogin |
|
117
|
|
|
* |
|
118
|
|
|
* @method static bool getEnableSession() Returns whether to use session to persist authentication status across multiple requests. |
|
119
|
|
|
* @see \yii\web\User::enableSession |
|
120
|
|
|
* |
|
121
|
|
|
* @method static string getIdParam() Returns the session variable name used to store the value of [[id]]. |
|
122
|
|
|
* @see \yii\web\User::idParam |
|
123
|
|
|
* |
|
124
|
|
|
* @method static string getIdentityClass() Returns the class name of the [[identity]] object. |
|
125
|
|
|
* @see \yii\web\User::identityClass |
|
126
|
|
|
* |
|
127
|
|
|
* @method static array getIdentityCookie() Returns the configuration of the identity cookie. |
|
128
|
|
|
* @see \yii\web\User::identityCookie |
|
129
|
|
|
* |
|
130
|
|
|
* @method static string|array getLoginUrl() Returns the URL for login when [[loginRequired()]] is called. |
|
131
|
|
|
* @see \yii\web\User::loginUrl |
|
132
|
|
|
* |
|
133
|
|
|
* @method static string getReturnUrlParam() Returns the session variable name used to store the value of [[returnUrl]]. |
|
134
|
|
|
* @see \yii\web\User::returnUrlParam |
|
135
|
|
|
* |
|
136
|
|
|
* @method static void setAbsoluteAuthTimeout(int $value) Sets the number of seconds in which the user will be logged out automatically regardless of activity. |
|
137
|
|
|
* @see \yii\web\User::absoluteAuthTimeout |
|
138
|
|
|
* |
|
139
|
|
|
* @method static void setAbsoluteAuthTimeoutParam(string $value) Sets the session variable name used to store the value of absolute expiration timestamp of the authenticated state. |
|
140
|
|
|
* @see \yii\web\User::absoluteAuthTimeoutParam |
|
141
|
|
|
* |
|
142
|
|
|
* @method static void setAcceptableRedirectTypes(array $value) Sets MIME types for which this component should redirect to the [[loginUrl]]. |
|
143
|
|
|
* @see \yii\web\User::acceptableRedirectTypes |
|
144
|
|
|
* |
|
145
|
|
|
* @method static void setAccessChecker(\yii\rbac\CheckAccessInterface $value) Sets The access checker to use for checking access. |
|
146
|
|
|
* @see \yii\web\User::accessChecker |
|
147
|
|
|
* |
|
148
|
|
|
* @method static void setAuthTimeout(int $value) Sets the number of seconds in which the user will be logged out automatically if he remains inactive. |
|
149
|
|
|
* @see \yii\web\User::authTimeout |
|
150
|
|
|
* |
|
151
|
|
|
* @method static void setAuthTimeoutParam(string $value) Sets the session variable name used to store the value of expiration timestamp of the authenticated state. |
|
152
|
|
|
* @see \yii\web\User::authTimeoutParam |
|
153
|
|
|
* |
|
154
|
|
|
* @method static void setAutoRenewCookie(bool $value) Sets whether to automatically renew the identity cookie each time a page is requested. |
|
155
|
|
|
* @see \yii\web\User::autoRenewCookie |
|
156
|
|
|
* |
|
157
|
|
|
* @method static void setEnableAutoLogin(bool $value) Sets whether to enable cookie-based login. |
|
158
|
|
|
* @see \yii\web\User::enableAutoLogin |
|
159
|
|
|
* |
|
160
|
|
|
* @method static void setEnableSession(bool $value) Sets whether to use session to persist authentication status across multiple requests. |
|
161
|
|
|
* @see \yii\web\User::enableSession |
|
162
|
|
|
* |
|
163
|
|
|
* @method static void setIdParam(string $value) Sets the session variable name used to store the value of [[id]]. |
|
164
|
|
|
* @see \yii\web\User::idParam |
|
165
|
|
|
* |
|
166
|
|
|
* @method static void setIdentityClass(string $value) Sets the class name of the [[identity]] object. |
|
167
|
|
|
* @see \yii\web\User::identityClass |
|
168
|
|
|
* |
|
169
|
|
|
* @method static void setIdentityCookie(array $value) Sets the configuration of the identity cookie. |
|
170
|
|
|
* @see \yii\web\User::identityCookie |
|
171
|
|
|
* |
|
172
|
|
|
* @method static void setLoginUrl(string|array $value) Sets the URL for login when [[loginRequired()]] is called. |
|
173
|
|
|
* @see \yii\web\User::loginUrl |
|
174
|
|
|
* |
|
175
|
|
|
* @method static void setReturnUrlParam(string $value) Sets the session variable name used to store the value of [[returnUrl]]. |
|
176
|
|
|
* @see \yii\web\User::returnUrlParam |
|
177
|
|
|
*/ |
|
178
|
|
|
class User extends Facade |
|
179
|
|
|
{ |
|
180
|
|
|
/** |
|
181
|
|
|
* @inheritDoc |
|
182
|
|
|
*/ |
|
183
|
1 |
|
public static function getFacadeComponentId() |
|
184
|
|
|
{ |
|
185
|
1 |
|
return 'user'; |
|
186
|
|
|
} |
|
187
|
|
|
} |
|
188
|
|
|
|