1 | <?php |
||
51 | class User extends ActiveRecord implements IdentityInterface |
||
52 | { |
||
53 | use ModuleAwareTrait; |
||
54 | use ContainerAwareTrait; |
||
55 | |||
56 | // following constants are used on secured email changing process |
||
57 | const OLD_EMAIL_CONFIRMED = 0b1; |
||
58 | const NEW_EMAIL_CONFIRMED = 0b10; |
||
59 | |||
60 | /** |
||
61 | * @var string Plain password. Used for model validation |
||
62 | */ |
||
63 | public $password; |
||
64 | /** |
||
65 | * @var array connected account list |
||
66 | */ |
||
67 | protected $connectedAccounts; |
||
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | 6 | public function beforeSave($insert) |
|
92 | |||
93 | /** |
||
94 | * @inheritdoc |
||
95 | */ |
||
96 | 6 | public function afterSave($insert, $changedAttributes) |
|
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | 10 | public static function tableName() |
|
113 | |||
114 | /** |
||
115 | * {@inheritdoc} |
||
116 | */ |
||
117 | 10 | public function behaviors() |
|
123 | |||
124 | /** |
||
125 | * {@inheritdoc} |
||
126 | */ |
||
127 | 2 | public function attributeLabels() |
|
139 | |||
140 | /** |
||
141 | * {@inheritdoc} |
||
142 | */ |
||
143 | 6 | public function scenarios() |
|
156 | |||
157 | /** |
||
158 | * {@inheritdoc} |
||
159 | */ |
||
160 | 6 | public function rules() |
|
190 | |||
191 | /** |
||
192 | * {@inheritdoc} |
||
193 | */ |
||
194 | public function validateAuthKey($authKey) |
||
198 | |||
199 | /** |
||
200 | * {@inheritdoc} |
||
201 | */ |
||
202 | 6 | public function getId() |
|
206 | |||
207 | /** |
||
208 | * {@inheritdoc} |
||
209 | */ |
||
210 | 1 | public function getAuthKey() |
|
214 | |||
215 | /** |
||
216 | * {@inheritdoc} |
||
217 | */ |
||
218 | 5 | public static function findIdentity($id) |
|
222 | |||
223 | /** |
||
224 | * @return bool whether is blocked or not |
||
225 | */ |
||
226 | 5 | public function getIsBlocked() |
|
230 | |||
231 | /** |
||
232 | * @return bool whether the user is an admin or not |
||
233 | */ |
||
234 | 2 | public function getIsAdmin() |
|
238 | |||
239 | /** |
||
240 | * Returns whether user account has been confirmed or not. |
||
241 | * @return bool whether user account has been confirmed or not |
||
242 | */ |
||
243 | 7 | public function getIsConfirmed() |
|
247 | |||
248 | /** |
||
249 | * Checks whether a user has a specific role. |
||
250 | * |
||
251 | * @param string $role |
||
252 | * |
||
253 | * @return bool |
||
254 | */ |
||
255 | public function hasRole($role) |
||
259 | |||
260 | /** |
||
261 | * @return \yii\db\ActiveQuery |
||
262 | */ |
||
263 | 5 | public function getProfile() |
|
267 | |||
268 | /** |
||
269 | * @return SocialNetworkAccount[] social connected accounts [ 'providerName' => socialAccountModel ] |
||
270 | */ |
||
271 | public function getSocialNetworkAccounts() |
||
289 | |||
290 | /** |
||
291 | * @return UserQuery |
||
292 | */ |
||
293 | 10 | public static function find() |
|
297 | |||
298 | /** |
||
299 | * {@inheritdoc} |
||
300 | */ |
||
301 | public static function findIdentityByAccessToken($token, $type = null) |
||
305 | } |
||
306 |