Yii Framework v1.1.10 绫诲弬鑰

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 灞炴 鍙

鎺堟潈绠$悊鍣

bizRule 灞炴
public string getBizRule()
public void setBizRule(string $value)

杩欎釜浠诲姟鍏宠仈鐨勪笟鍔¤鍒欍

children 灞炴 鍙
public array getChildren()

杩斿洖杩欎釜椤圭洰鐨勬墍鏈夊瓙椤圭洰銆

data 灞炴
public mixed getData()
public void setData(mixed $value)

杩欎釜浠诲姟鐨勯澶栫殑鏁版嵁銆

description 灞炴
public string getDescription()
public void setDescription(string $value)

椤圭洰鎻忚堪

name 灞炴
public string getName()
public void setName(string $value)

椤圭洰鍚嶅瓧銆

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 杩欎釜浠诲姟鐨勯澶栫殑鏁版嵁銆
婧愮爜锛 framework/web/auth/CAuthItem.php#167 (鏄剧ず)
public function getData()
{
    return 
$this->_data;
}

getDescription() 鏂规硶
public string getDescription()
{return} string 椤圭洰鎻忚堪
婧愮爜锛 framework/web/auth/CAuthItem.php#127 (鏄剧ず)
public function getDescription()
{
    return 
$this->_description;
}

getName() 鏂规硶
public string getName()
{return} string 椤圭洰鍚嶅瓧銆
婧愮爜锛 framework/web/auth/CAuthItem.php#106 (鏄剧ず)
public function getName()
{
    return 
$this->_name;
}

getType() 鏂规硶
public integer getType()
{return} integer 鎺堟潈椤圭洰绫诲瀷銆傚寘鎷0锛堟搷浣滐級锛1锛堜换鍔★級鎴栬2锛堣鑹诧級銆
婧愮爜锛 framework/web/auth/CAuthItem.php#98 (鏄剧ず)
public function getType()
{
    return 
$this->_type;
}

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);
    }
}

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