mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Fixes #8556: Extracted yii\web\User::getAuthManager()
method
This commit is contained in:
@ -29,6 +29,7 @@ Yii Framework 2 Change Log
|
|||||||
- Enh #8566: Added support for 'only' and 'except' options for `yii\web\AssetManager::publish()` (klimov-paul)
|
- Enh #8566: Added support for 'only' and 'except' options for `yii\web\AssetManager::publish()` (klimov-paul)
|
||||||
- Enh #8574: Added `yii\console\controllers\MessageController` support .pot file creation (pgaultier)
|
- Enh #8574: Added `yii\console\controllers\MessageController` support .pot file creation (pgaultier)
|
||||||
- Chg #6354: `ErrorHandler::logException()` will now log the whole exception object instead of only its string representation (cebe)
|
- Chg #6354: `ErrorHandler::logException()` will now log the whole exception object instead of only its string representation (cebe)
|
||||||
|
- Chg #8556: Extracted `yii\web\User::getAuthManager()` method (samdark)
|
||||||
|
|
||||||
|
|
||||||
2.0.4 May 10, 2015
|
2.0.4 May 10, 2015
|
||||||
|
@ -655,7 +655,7 @@ class User extends Component
|
|||||||
*/
|
*/
|
||||||
public function can($permissionName, $params = [], $allowCaching = true)
|
public function can($permissionName, $params = [], $allowCaching = true)
|
||||||
{
|
{
|
||||||
$auth = Yii::$app->getAuthManager();
|
$auth = $this->getAuthManager();
|
||||||
if ($allowCaching && empty($params) && isset($this->_access[$permissionName])) {
|
if ($allowCaching && empty($params) && isset($this->_access[$permissionName])) {
|
||||||
return $this->_access[$permissionName];
|
return $this->_access[$permissionName];
|
||||||
}
|
}
|
||||||
@ -666,4 +666,14 @@ class User extends Component
|
|||||||
|
|
||||||
return $access;
|
return $access;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns auth manager associated with the user component.
|
||||||
|
* @return \yii\rbac\ManagerInterface
|
||||||
|
* @since 2.0.5
|
||||||
|
*/
|
||||||
|
protected function getAuthManager()
|
||||||
|
{
|
||||||
|
return Yii::$app->getAuthManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user