CAuthItem
鍖 | system.web.auth |
---|---|
缁ф壙 | class CAuthItem » CComponent |
婧愯嚜 | 1.0 |
鐗堟湰 | $Id: CAuthItem.php 3442 2011-11-09 02:48:50Z alexander.makarow $ |
婧愮爜 | framework/web/auth/CAuthItem.php |
CAuthItem浠h〃鐨勬巿鏉冮」鐩
涓涓巿鏉冮」鐩彲浠ユ槸涓涓搷浣滐紝涓涓换鍔★紝鎴栬呮槸涓涓鑹层
浠栦滑褰㈡垚涓涓巿鏉冪殑灞傜骇鍏崇郴銆傚湪杩欎釜灞傜骇閲岄潰锛
楂樺眰缁ф壙浜嗕綆灞傜殑鏉冮檺銆
涓涓敤鎴峰彲浠ユ巿鏉冧竴涓垨鑰呭涓」鐩紙绉颁箣涓浠诲姟锛夈
浠栧彧鑳借闂偅浜涘凡缁忔巿鏉冪殑椤圭洰銆
鍏叡灞炴
灞炴 | 绫诲瀷 | 鎻忚堪 | 瀹氫箟鍦 |
---|---|---|---|
authManager | IAuthManager | 鎺堟潈绠$悊鍣 | CAuthItem |
bizRule | string | 杩欎釜浠诲姟鍏宠仈鐨勪笟鍔¤鍒欍 | CAuthItem |
children | array | 杩斿洖杩欎釜椤圭洰鐨勬墍鏈夊瓙椤圭洰銆 | CAuthItem |
data | mixed | 杩欎釜浠诲姟鐨勯澶栫殑鏁版嵁銆 | CAuthItem |
description | string | 椤圭洰鎻忚堪 | CAuthItem |
name | string | 椤圭洰鍚嶅瓧銆 | CAuthItem |
type | integer | 鎺堟潈椤圭洰绫诲瀷銆傚寘鎷0锛堟搷浣滐級锛1锛堜换鍔★級鎴栬2锛堣鑹诧級銆 | CAuthItem |
鍏叡鏂规硶
鏂规硶 | 鎻忚堪 | 瀹氫箟鍦 |
---|---|---|
__call() | 濡傛灉绫讳腑娌℃湁璋冪殑鏂规硶鍚嶏紝鍒欒皟鐢ㄨ繖涓柟娉曘 | CComponent |
__construct() | 鏋勯犳柟娉曘 | CAuthItem |
__get() | 杩斿洖涓涓睘鎬у笺佷竴涓簨浠跺鐞嗙▼搴忓垪琛ㄦ垨涓涓涓哄悕绉般 | CComponent |
__isset() | 妫鏌ヤ竴涓睘鎬ф槸鍚︿负null銆 | CComponent |
__set() | 璁剧疆涓涓粍浠剁殑灞炴у笺 | CComponent |
__unset() | 璁剧疆涓涓粍浠剁殑灞炴т负null銆 | CComponent |
addChild() | 娣诲姞涓涓瓙椤圭洰銆 | CAuthItem |
asa() | 杩斿洖杩欎釜鍚嶅瓧鐨勮涓哄璞° | CComponent |
assign() | 灏嗚繖涓」鐩祴浜堢粰鐢ㄦ埛銆 | CAuthItem |
attachBehavior() | 闄勫姞涓涓涓哄埌缁勪欢銆 | CComponent |
attachBehaviors() | 闄勫姞涓涓涓哄垪琛ㄥ埌缁勪欢銆 | CComponent |
attachEventHandler() | 涓轰簨浠堕檮鍔犱竴涓簨浠跺鐞嗙▼搴忋 | CComponent |
canGetProperty() | 纭畾灞炴ф槸鍚﹀彲璇汇 | CComponent |
canSetProperty() | 纭畾灞炴ф槸鍚﹀彲鍐欍 | CComponent |
checkAccess() | 妫鏌ユ寚瀹氱殑椤圭洰鏄惁鍦ㄥ綋鍓嶈繖涓」鐩殑灞傜骇閲岄潰銆 | CAuthItem |
detachBehavior() | 浠庣粍浠朵腑鍒嗙涓涓涓恒 | CComponent |
detachBehaviors() | 浠庣粍浠朵腑鍒嗙鎵鏈夎涓恒 | CComponent |
detachEventHandler() | 鍒嗙涓涓瓨鍦ㄧ殑浜嬩欢澶勭悊绋嬪簭銆 | CComponent |
disableBehavior() | 绂佺敤涓涓檮鍔犺涓恒 | CComponent |
disableBehaviors() | 绂佺敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 | CComponent |
enableBehavior() | 鍚敤涓涓檮鍔犺涓恒 | CComponent |
enableBehaviors() | 鍚敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 | CComponent |
evaluateExpression() | 璁$畻涓涓狿HP琛ㄨ揪寮忥紝鎴栨牴鎹粍浠朵笂涓嬫枃鎵ц鍥炶皟銆 | CComponent |
getAssignment() | 杩斿洖璧嬩簣鐨勯」鐩换鍔′俊鎭 | CAuthItem |
getAuthManager() | 杩斿洖鎺堟潈绠$悊鍣 | CAuthItem |
getBizRule() | 杩斿洖杩欎釜浠诲姟鍏宠仈鐨勪笟鍔¤鍒欍 | CAuthItem |
getChildren() | 杩斿洖杩欎釜椤圭洰鐨勬墍鏈夊瓙椤圭洰銆 | CAuthItem |
getData() | 杩斿洖杩欎釜浠诲姟鐨勯澶栫殑鏁版嵁銆 | CAuthItem |
getDescription() | 杩斿洖椤圭洰鎻忚堪 | CAuthItem |
getEventHandlers() | 杩斿洖涓涓簨浠剁殑闄勫姞澶勭悊绋嬪簭鍒楄〃銆 | CComponent |
getName() | 杩斿洖椤圭洰鍚嶅瓧銆 | CAuthItem |
getType() | 杩斿洖鎺堟潈椤圭洰绫诲瀷銆傚寘鎷0锛堟搷浣滐級锛1锛堜换鍔★級鎴栬2锛堣鑹诧級銆 | CAuthItem |
hasChild() | 杩斿洖涓涓艰鏄庤繖涓瓙椤圭洰鏄惁瀛樺湪 | CAuthItem |
hasEvent() | 纭畾涓涓簨浠舵槸鍚﹀畾涔夈 | CComponent |
hasEventHandler() | 妫鏌ヤ簨浠舵槸鍚︽湁闄勫姞鐨勫鐞嗙▼搴忋 | CComponent |
hasProperty() | 纭畾灞炴ф槸鍚﹁瀹氫箟銆 | CComponent |
isAssigned() | 杩斿洖鍊艰鏄庤繖涓」鐩槸鍚﹀凡缁忚祴浜堢粰鐢ㄦ埛銆 | CAuthItem |
raiseEvent() | 鍙戣捣涓涓簨浠躲 | CComponent |
removeChild() | 绉婚櫎瀛愰」鐩 | CAuthItem |
revoke() | 鎾ゆ秷鐢ㄦ埛鐨勬巿鏉冧换鍔° | CAuthItem |
setBizRule() | 璁剧疆杩欎釜浠诲姟鍏宠仈鐨勪笟鍔¤鍒欍 | CAuthItem |
setData() | 璁剧疆杩欎釜浠诲姟鐨勯澶栫殑鏁版嵁銆 | CAuthItem |
setDescription() | 璁剧疆椤圭洰鎻忚堪 | CAuthItem |
setName() | 璁剧疆椤圭洰鍚嶅瓧銆 | CAuthItem |
灞炴ц缁
authManager
灞炴
鍙
public IAuthManager getAuthManager()
鎺堟潈绠$悊鍣
bizRule
灞炴
杩欎釜浠诲姟鍏宠仈鐨勪笟鍔¤鍒欍
children
灞炴
鍙
public array getChildren()
杩斿洖杩欎釜椤圭洰鐨勬墍鏈夊瓙椤圭洰銆
data
灞炴
杩欎釜浠诲姟鐨勯澶栫殑鏁版嵁銆
description
灞炴
椤圭洰鎻忚堪
name
灞炴
椤圭洰鍚嶅瓧銆
type
灞炴
鍙
public integer getType()
鎺堟潈椤圭洰绫诲瀷銆傚寘鎷0锛堟搷浣滐級锛1锛堜换鍔★級鎴栬2锛堣鑹诧級銆
鏂规硶璇︾粏
__construct()
鏂规硶
public void __construct(IAuthManager $auth, string $name, integer $type, description $description='', string $bizRule=NULL, mixed $data=NULL)
| ||
$auth | IAuthManager | 鎺堟潈绠$悊鍣ㄣ |
$name | string | 鎺堟潈椤圭洰鍚嶅瓧銆 |
$type | integer | 鎺堟潈椤圭洰绫诲瀷銆傚寘鎷0锛堟搷浣滐級锛1锛堜换鍔★級鎴栬2锛堣鑹诧級銆 |
$description | description | 椤圭洰鎻忚堪銆 |
$bizRule | string | 杩欎釜椤圭洰鍏宠仈鐨勪笟鍔¤鍒欍 |
$data | mixed | 杩欎釜浠诲姟鐨勯澶栫殑鏁版嵁銆 |
婧愮爜锛 framework/web/auth/CAuthItem.php#54 (鏄剧ず)
public function __construct($auth,$name,$type,$description='',$bizRule=null,$data=null)
{
$this->_type=(int)$type;
$this->_auth=$auth;
$this->_name=$name;
$this->_description=$description;
$this->_bizRule=$bizRule;
$this->_data=$data;
}
鏋勯犳柟娉曘
addChild()
鏂规硶
public boolean addChild(string $name)
| ||
$name | string | 瀛愰」鐩殑鍚嶅瓧 |
{return} | boolean | 杩欎釜椤圭洰鏄惁宸茬粡琚垚鍔熸坊鍔 |
婧愮爜锛 framework/web/auth/CAuthItem.php#191 (鏄剧ず)
public function addChild($name)
{
return $this->_auth->addItemChild($this->_name,$name);
}
娣诲姞涓涓瓙椤圭洰銆
assign()
鏂规硶
public CAuthAssignment assign(mixed $userId, string $bizRule=NULL, mixed $data=NULL)
| ||
$userId | mixed | 鐢ㄦ埛ID锛堣瑙IWebUser::getId锛 |
$bizRule | string | 褰撹皟鐢checkAccess鐗瑰埆鏄巿鏉冮」鐩 鏃惰杩愯鐨勪笟鍔¤鍒欍 |
$data | mixed | 闅忕潃杩欎釜浠诲姟鎵闄勫甫鐨勯澶栨暟鎹 |
{return} | CAuthAssignment | 鎺堟潈浠诲姟淇℃伅銆 |
婧愮爜锛 framework/web/auth/CAuthItem.php#239 (鏄剧ず)
public function assign($userId,$bizRule=null,$data=null)
{
return $this->_auth->assign($this->_name,$userId,$bizRule,$data);
}
灏嗚繖涓」鐩祴浜堢粰鐢ㄦ埛銆
checkAccess()
鏂规硶
public boolean checkAccess(string $itemName, array $params=array (
))
| ||
$itemName | string | 瑕佹鏌ョ殑椤圭洰鍚嶅瓧銆 |
$params | array | 瑕佷紶閫掔粰涓氬姟瑙勫垯瀹¤瘎鐨勫弬鏁般 |
{return} | boolean | 鎸囧畾鐨勯」鐩槸鍚﹀瓨鍦ㄤ簬杩欎釜椤圭洰鐨勫眰绾ч噷闈€ |
婧愮爜锛 framework/web/auth/CAuthItem.php#71 (鏄剧ず)
public function checkAccess($itemName,$params=array())
{
Yii::trace('Checking permission "'.$this->_name.'"','system.web.auth.CAuthItem');
if($this->_auth->executeBizRule($this->_bizRule,$params,$this->_data))
{
if($this->_name==$itemName)
return true;
foreach($this->_auth->getItemChildren($this->_name) as $item)
{
if($item->checkAccess($itemName,$params))
return true;
}
}
return false;
}
妫鏌ユ寚瀹氱殑椤圭洰鏄惁鍦ㄥ綋鍓嶈繖涓」鐩殑灞傜骇閲岄潰銆 杩欎釜鏂规硶鏄IAuthManager::checkAccess鍐呴儴浣跨敤鐨勩
getAssignment()
鏂规硶
public CAuthAssignment getAssignment(mixed $userId)
| ||
$userId | mixed | 鐢ㄦ埛ID (璇﹁IWebUser::getId锛 |
{return} | CAuthAssignment | 璧嬩簣鐨勯」鐩殑淇℃伅銆傝繑鍥濶ull 鎰忓懗鐫杩欎釜椤圭洰娌℃湁璧嬩簣缁欑敤鎴枫 |
婧愮爜锛 framework/web/auth/CAuthItem.php#273 (鏄剧ず)
public function getAssignment($userId)
{
return $this->_auth->getAuthAssignment($this->_name,$userId);
}
杩斿洖璧嬩簣鐨勯」鐩换鍔′俊鎭
getAuthManager()
鏂规硶
public IAuthManager getAuthManager()
| ||
{return} | IAuthManager | 鎺堟潈绠$悊鍣 |
婧愮爜锛 framework/web/auth/CAuthItem.php#90 (鏄剧ず)
public function getAuthManager()
{
return $this->_auth;
}
getBizRule()
鏂规硶
public string getBizRule()
| ||
{return} | string | 杩欎釜浠诲姟鍏宠仈鐨勪笟鍔¤鍒欍 |
婧愮爜锛 framework/web/auth/CAuthItem.php#147 (鏄剧ず)
public function getBizRule()
{
return $this->_bizRule;
}
getChildren()
鏂规硶
public array getChildren()
| ||
{return} | array | 杩欎釜椤圭洰鐨勬墍鏈夊瓙椤圭洰銆 |
婧愮爜锛 framework/web/auth/CAuthItem.php#224 (鏄剧ず)
public function getChildren()
{
return $this->_auth->getItemChildren($this->_name);
}
杩斿洖杩欎釜椤圭洰鐨勬墍鏈夊瓙椤圭洰銆
getData()
鏂规硶
public mixed getData()
| ||
{return} | mixed | 杩欎釜浠诲姟鐨勯澶栫殑鏁版嵁銆 |
getDescription()
鏂规硶
public string getDescription()
| ||
{return} | string | 椤圭洰鎻忚堪 |
婧愮爜锛 framework/web/auth/CAuthItem.php#127 (鏄剧ず)
public function getDescription()
{
return $this->_description;
}
getName()
鏂规硶
public string getName()
| ||
{return} | string | 椤圭洰鍚嶅瓧銆 |
getType()
鏂规硶
public integer getType()
| ||
{return} | integer | 鎺堟潈椤圭洰绫诲瀷銆傚寘鎷0锛堟搷浣滐級锛1锛堜换鍔★級鎴栬2锛堣鑹诧級銆 |
hasChild()
鏂规硶
public boolean hasChild(string $name)
| ||
$name | string | 瀛愰」鐩悕瀛 |
{return} | boolean | 杩欎釜瀛愰」鐩槸鍚﹀瓨鍦 |
婧愮爜锛 framework/web/auth/CAuthItem.php#214 (鏄剧ず)
public function hasChild($name)
{
return $this->_auth->hasItemChild($this->_name,$name);
}
杩斿洖涓涓艰鏄庤繖涓瓙椤圭洰鏄惁瀛樺湪
isAssigned()
鏂规硶
public boolean isAssigned(mixed $userId)
| ||
$userId | mixed | 鐢ㄦ埛ID (璇﹁IWebUser::getId锛 |
{return} | boolean | 濡傛灉椤圭洰宸茬粡璧嬩簣缁欑敤鎴凤紝鍒欐姏鍑哄紓甯搞 |
婧愮爜锛 framework/web/auth/CAuthItem.php#261 (鏄剧ず)
public function isAssigned($userId)
{
return $this->_auth->isAssigned($this->_name,$userId);
}
杩斿洖鍊艰鏄庤繖涓」鐩槸鍚﹀凡缁忚祴浜堢粰鐢ㄦ埛銆
removeChild()
鏂规硶
public boolean removeChild(string $name)
| ||
$name | string | 瀛愰」鐩悕瀛 |
{return} | boolean | 杩斿洖鏄惁鍒犻櫎鎴愬姛 |
婧愮爜锛 framework/web/auth/CAuthItem.php#203 (鏄剧ず)
public function removeChild($name)
{
return $this->_auth->removeItemChild($this->_name,$name);
}
绉婚櫎瀛愰」鐩 瑕佹敞鎰忕殑鏄紝瀛愰」鐩槸娌℃湁琚垹闄ょ殑銆傚彧鏄畠璺熺埗椤圭洰鐨勫叧绯昏В銆
revoke()
鏂规硶
public boolean revoke(mixed $userId)
| ||
$userId | mixed | 鐢ㄦ埛ID (璇﹁IWebUser::getId锛 |
{return} | boolean | 鏄惁宸茬粡绉婚櫎鎴愬姛 |
婧愮爜锛 framework/web/auth/CAuthItem.php#250 (鏄剧ず)
public function revoke($userId)
{
$this->_auth->revoke($this->_name,$userId);
}
鎾ゆ秷鐢ㄦ埛鐨勬巿鏉冧换鍔°
setBizRule()
鏂规硶
public void setBizRule(string $value)
| ||
$value | string | 杩欎釜浠诲姟鍏宠仈鐨勪笟鍔¤鍒欍 |
婧愮爜锛 framework/web/auth/CAuthItem.php#155 (鏄剧ず)
public function setBizRule($value)
{
if($this->_bizRule!==$value)
{
$this->_bizRule=$value;
$this->_auth->saveAuthItem($this);
}
}
setData()
鏂规硶
public void setData(mixed $value)
| ||
$value | mixed | 杩欎釜浠诲姟鐨勯澶栫殑鏁版嵁銆 |
婧愮爜锛 framework/web/auth/CAuthItem.php#175 (鏄剧ず)
public function setData($value)
{
if($this->_data!==$value)
{
$this->_data=$value;
$this->_auth->saveAuthItem($this);
}
}
setDescription()
鏂规硶
public void setDescription(string $value)
| ||
$value | string | 椤圭洰鎻忚堪 |
婧愮爜锛 framework/web/auth/CAuthItem.php#135 (鏄剧ず)
public function setDescription($value)
{
if($this->_description!==$value)
{
$this->_description=$value;
$this->_auth->saveAuthItem($this);
}
}
setName()
鏂规硶
public void setName(string $value)
| ||
$value | string | 椤圭洰鍚嶅瓧銆 |
婧愮爜锛 framework/web/auth/CAuthItem.php#114 (鏄剧ず)
public function setName($value)
{
if($this->_name!==$value)
{
$oldName=$this->_name;
$this->_name=$value;
$this->_auth->saveAuthItem($this,$oldName);
}
}