update phân quyền chi tiết
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user