From 86312e14dc8a434ac688e74496a8633e79d74caa Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 17 Dec 2019 15:47:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/controllers/SiteController.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/backend/controllers/SiteController.php b/backend/controllers/SiteController.php index 4e96599..4214227 100755 --- a/backend/controllers/SiteController.php +++ b/backend/controllers/SiteController.php @@ -3,16 +3,17 @@ namespace backend\controllers; use backend\logic\PermissionManager; +use ReflectionException; use Yii; +use yii\base\InvalidConfigException; use yii\web\Controller; use yii\filters\VerbFilter; use yii\filters\AccessControl; use backend\models\LoginForm; -use backend\models\CategorySearch; /** * Site controller - * DESCRIBE 网站基本权限 DESCRIBE + * @DESCRIBE 网站基本权限 DESCRIBE */ class SiteController extends Controller { @@ -25,7 +26,7 @@ class SiteController extends Controller { 'class' => AccessControl::className(), 'rules' => [ [ - 'actions' => ['login', 'error', 'test'], + 'actions' => ['login', 'error', 'get-permission'], 'allow' => true, ], [ @@ -71,7 +72,7 @@ class SiteController extends Controller { * Login action. * * @return string - * ACTION 登录 ACTION + * @ACTION 登录 ACTION */ public function actionLogin() { @@ -97,7 +98,7 @@ class SiteController extends Controller { * Logout action. * * @return string - * ACTION 登出 ACTION + * @ACTION 登出 ACTION */ public function actionLogout() { Yii::$app->user->logout(); @@ -105,4 +106,15 @@ class SiteController extends Controller { return $this->goHome(); } + /** + * 获取权限 + * @return array + * @throws ReflectionException + * @throws InvalidConfigException + */ + public function actionGetPermission() + { + return PermissionManager::getAppPermission(); + } + }