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