|
|
@@ -9,6 +9,8 @@ use Yii;
|
|
|
class AuthController extends BaseController
|
|
|
{
|
|
|
|
|
|
+ public $enableCsrfValidation = false;
|
|
|
+
|
|
|
//获取权限树 shish 2019.11.24
|
|
|
public function actionTree()
|
|
|
{
|
|
|
@@ -17,5 +19,32 @@ class AuthController extends BaseController
|
|
|
$tree = AuthService::getTree($endId);
|
|
|
util::success($tree);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ //添加权限 shish 2019.11.24
|
|
|
+ public function actionAdd()
|
|
|
+ {
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ $endId = isset($post['endId']) ? $post['endId'] : 1;
|
|
|
+ $authName = isset($post['authName']) ? $post['authName'] : '';
|
|
|
+ $list = AuthService::getNameList($endId);
|
|
|
+ if (in_array($authName, $list)) {
|
|
|
+ util::fail('名称已经存在');
|
|
|
+ }
|
|
|
+ AuthService::add($_POST);
|
|
|
+ util::ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function actionModify()
|
|
|
+ {
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ $endId = isset($post['endId']) ? $post['endId'] : 1;
|
|
|
+ $authName = isset($post['authName']) ? $post['authName'] : '';
|
|
|
+ $list = AuthService::getNameList($endId);
|
|
|
+ if (in_array($authName, $list)) {
|
|
|
+ util::fail('名称已经存在');
|
|
|
+ }
|
|
|
+ AuthService::add($_POST);
|
|
|
+ util::ok();
|
|
|
+ }
|
|
|
+
|
|
|
}
|