Yii Framework v1.1.10 绫诲弬鑰

CUserIdentity

system.web.auth
缁ф壙 class CUserIdentity » CBaseUserIdentity » CComponent
瀹炵幇 IUserIdentity
婧愯嚜 1.0
鐗堟湰 $Id: CUserIdentity.php 3426 2011-10-25 00:01:09Z alexander.makarow $
婧愮爜 framework/web/auth/CUserIdentity.php
CUserIdentity鏄竴涓熀浜庣敤鎴峰悕楠岃瘉鐨勮韩浠藉拰瀵嗙爜鐨勫熀绫

娲剧敓绫诲簲璇ヤ娇鐢ㄥ疄闄呯殑楠岃瘉鏈哄埗鏉ュ疄鐜authenticate锛 锛堟瘮濡傝锛屽鐓ф暟鎹〃鏉ユ鏌ョ敤鎴峰悕鍜屽瘑鐮侊級銆

榛樿鏄紝CUserIdentity璁や负username鏄敮涓鐨勮瘑鍒紝 鍥犱负鎶婂畠褰撲綔ID鏉ユ鏌ャ

鍏叡灞炴

闅愯棌缁ф壙灞炴

灞炴绫诲瀷鎻忚堪瀹氫箟鍦
errorCode integer 楠岃瘉閿欒浠g爜銆傚鏋滄槸鏈夐敊璇彂鐢燂紝閭d箞閿欒浠g爜涓嶄細涓0銆 榛樿鏄100锛屾剰鍛崇潃鏈煡鐨勮韩浠姐傝皟鐢authenticate鍙互鏀瑰彉杩欎釜鍊笺 CBaseUserIdentity
errorMessage string 楠岃瘉閿欒淇℃伅銆傞粯璁や负绌恒 CBaseUserIdentity
id string 杩斿洖鍞竴鐨勮韩浠芥爣璇嗐 CUserIdentity
isAuthenticated 楠岃瘉鏄惁鎴愬姛銆 杩斿洖鍊艰鏄庤韩浠芥槸鍚﹂氳繃楠岃瘉銆 CBaseUserIdentity
name string 杩斿洖韬唤鐨勬樉绀哄悕瀛椼 CUserIdentity
password string 瀵嗙爜 CUserIdentity
persistentStates array 杩斿洖闇瑕佹寔涔呭寲鐨勮韩浠界姸鎬併 CBaseUserIdentity
username string 鐢ㄦ埛鍚 CUserIdentity

鍏叡鏂规硶

闅愯棌缁ф壙鏂规硶

鏂规硶鎻忚堪瀹氫箟鍦
__call() 濡傛灉绫讳腑娌℃湁璋冪殑鏂规硶鍚嶏紝鍒欒皟鐢ㄨ繖涓柟娉曘 CComponent
__construct() 鏋勯犳柟娉 CUserIdentity
__get() 杩斿洖涓涓睘鎬у笺佷竴涓簨浠跺鐞嗙▼搴忓垪琛ㄦ垨涓涓涓哄悕绉般 CComponent
__isset() 妫鏌ヤ竴涓睘鎬ф槸鍚︿负null銆 CComponent
__set() 璁剧疆涓涓粍浠剁殑灞炴у笺 CComponent
__unset() 璁剧疆涓涓粍浠剁殑灞炴т负null銆 CComponent
asa() 杩斿洖杩欎釜鍚嶅瓧鐨勮涓哄璞° CComponent
attachBehavior() 闄勫姞涓涓涓哄埌缁勪欢銆 CComponent
attachBehaviors() 闄勫姞涓涓涓哄垪琛ㄥ埌缁勪欢銆 CComponent
attachEventHandler() 涓轰簨浠堕檮鍔犱竴涓簨浠跺鐞嗙▼搴忋 CComponent
authenticate() 鍩轰簬usernamepassword瀵圭敤鎴疯繘琛岄獙璇併 CUserIdentity
canGetProperty() 纭畾灞炴ф槸鍚﹀彲璇汇 CComponent
canSetProperty() 纭畾灞炴ф槸鍚﹀彲鍐欍 CComponent
clearState() 绉婚櫎鎸囧畾鐨勭姸鎬併 CBaseUserIdentity
detachBehavior() 浠庣粍浠朵腑鍒嗙涓涓涓恒 CComponent
detachBehaviors() 浠庣粍浠朵腑鍒嗙鎵鏈夎涓恒 CComponent
detachEventHandler() 鍒嗙涓涓瓨鍦ㄧ殑浜嬩欢澶勭悊绋嬪簭銆 CComponent
disableBehavior() 绂佺敤涓涓檮鍔犺涓恒 CComponent
disableBehaviors() 绂佺敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 CComponent
enableBehavior() 鍚敤涓涓檮鍔犺涓恒 CComponent
enableBehaviors() 鍚敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 CComponent
evaluateExpression() 璁$畻涓涓狿HP琛ㄨ揪寮忥紝鎴栨牴鎹粍浠朵笂涓嬫枃鎵ц鍥炶皟銆 CComponent
getEventHandlers() 杩斿洖涓涓簨浠剁殑闄勫姞澶勭悊绋嬪簭鍒楄〃銆 CComponent
getId() 杩斿洖鍞竴鐨勮韩浠芥爣璇嗐 CUserIdentity
getIsAuthenticated() 杩斿洖鍊艰鏄庤韩浠芥槸鍚﹂氳繃楠岃瘉銆 CBaseUserIdentity
getName() 杩斿洖韬唤鐨勬樉绀哄悕瀛椼 CUserIdentity
getPersistentStates() 杩斿洖闇瑕佹寔涔呭寲鐨勮韩浠界姸鎬併 CBaseUserIdentity
getState() 鑾峰彇鎸囧畾鍚嶅瓧鐨勬寔涔呭寲鐘舵併 CBaseUserIdentity
hasEvent() 纭畾涓涓簨浠舵槸鍚﹀畾涔夈 CComponent
hasEventHandler() 妫鏌ヤ簨浠舵槸鍚︽湁闄勫姞鐨勫鐞嗙▼搴忋 CComponent
hasProperty() 纭畾灞炴ф槸鍚﹁瀹氫箟銆 CComponent
raiseEvent() 鍙戣捣涓涓簨浠躲 CComponent
setPersistentStates() 璁剧疆鎸佷箙鍖栫姸鎬佹暟缁勩 CBaseUserIdentity
setState() 璁剧疆鎸囧畾鐘舵佺殑鍊笺 CBaseUserIdentity

灞炴ц缁

id 灞炴 鍙
public string getId()

杩斿洖鍞竴鐨勮韩浠芥爣璇嗐 榛樿瀹炵幇浼氳繑鍥username銆 姝ゆ柟娉曚负鎺ュ彛IUserIdentity寮哄埗瑕佹眰瀹炵幇銆

name 灞炴 鍙
public string getName()

杩斿洖韬唤鐨勬樉绀哄悕瀛椼 榛樿瀹炵幇杩斿洖username銆 姝ゆ柟娉曚负鎺ュ彛IUserIdentity寮哄埗瑕佹眰瀹炵幇銆

password 灞炴
public string $password;

瀵嗙爜

username 灞炴
public string $username;

鐢ㄦ埛鍚

鏂规硶璇︾粏

__construct() 鏂规硶
public void __construct(string $username, string $password)
$username string 鐢ㄦ埛鍚
$password string 瀵嗙爜
婧愮爜锛 framework/web/auth/CUserIdentity.php#44 (鏄剧ず)
public function __construct($username,$password)
{
    
$this->username=$username;
    
$this->password=$password;
}

鏋勯犳柟娉

authenticate() 鏂规硶
public boolean authenticate()
{return} boolean 鏄惁楠岃瘉鎴愬姛銆
婧愮爜锛 framework/web/auth/CUserIdentity.php#56 (鏄剧ず)
public function authenticate()
{
    throw new 
CException(Yii::t('yii','{class}::authenticate() must be implemented.',array('{class}'=>get_class($this))));
}

鍩轰簬usernamepassword瀵圭敤鎴疯繘琛岄獙璇併 娲剧敓绫诲簲璇ラ噸鍐欒繖涓柟娉曪紝鍚﹀垯灏变細鎶涘嚭寮傚父銆 姝ゆ柟娉曚负鎺ュ彛IUserIdentity寮哄埗瑕佹眰瀹炵幇銆

getId() 鏂规硶
public string getId()
{return} string the unique identifier for the identity.
婧愮爜锛 framework/web/auth/CUserIdentity.php#67 (鏄剧ず)
public function getId()
{
    return 
$this->username;
}

杩斿洖鍞竴鐨勮韩浠芥爣璇嗐 榛樿瀹炵幇浼氳繑鍥username銆 姝ゆ柟娉曚负鎺ュ彛IUserIdentity寮哄埗瑕佹眰瀹炵幇銆

getName() 鏂规硶
public string getName()
{return} string 鏍囪瘑鐨勬樉绀哄悕瀛椼
婧愮爜锛 framework/web/auth/CUserIdentity.php#78 (鏄剧ず)
public function getName()
{
    return 
$this->username;
}

杩斿洖韬唤鐨勬樉绀哄悕瀛椼 榛樿瀹炵幇杩斿洖username銆 姝ゆ柟娉曚负鎺ュ彛IUserIdentity寮哄埗瑕佹眰瀹炵幇銆

Copyright © 2008-2011 by Yii Software LLC
All Rights Reserved.