update phân quyền chi tiết

This commit is contained in:
2020-11-02 14:35:22 +07:00
parent c4bb81e55c
commit e4a665dd2e
29 changed files with 1188 additions and 343 deletions

View File

@@ -52,6 +52,12 @@ class ScheduleController extends Controller {
public function actionCreate() {
$model = new Schedule();
Yii::$app->response->format = "json";
if (!Yii::$app->user->can(Yii::$app->controller->id . "Create"))
return [
"title" => Html::tag("i", "", ["class" => "fa fa-info-circle"]) . " Cảnh báo",
"form" => "Bạn không có quyền truy cập"
];
if (Yii::$app->request->post()) {
$post = Yii::$app->request->post();
$data = [
@@ -98,6 +104,12 @@ class ScheduleController extends Controller {
public function actionUpdate($id) {
$model = $this->findModel($id);
Yii::$app->response->format = "json";
if (!Yii::$app->user->can(Yii::$app->controller->id . "Update"))
return [
"title" => Html::tag("i", "", ["class" => "fa fa-info-circle"]) . " Cảnh báo",
"form" => "Bạn không có quyền truy cập"
];
if (Yii::$app->request->post()) {
$post = Yii::$app->request->post();
$model->name = $post["Name"];
@@ -141,6 +153,12 @@ class ScheduleController extends Controller {
}
public function actionDelete() {
if (!Yii::$app->user->can(Yii::$app->controller->id . "Delete"))
return [
"title" => Html::tag("i", "", ["class" => "fa fa-info-circle"]) . " Cảnh báo",
"form" => "Bạn không có quyền truy cập"
];
if (Yii::$app->request->post()) {
$lists = Yii::$app->request->post("lists");
Schedule::deleteAll(["IN", "id", $lists]);