public function actionUnAssignRole($role_id, $task_id) { if (preg_match('/^\\d+$/', $task_id) && preg_match('/^\\d+$/', $role_id)) { models\RbacRoleTask::deleteRoleTask($role_id, $task_id); } else { throw new Exception('params is not safe!'); } return $this->redirect(['/rbac/authtask/related-role', 'id' => $task_id]); }
/** * 删除角色的授权任务 * @author lixupeng * @param type $id * @throws Exception */ public function actionDeleteAssignItems($id) { $model = self::findModel($id); $items = Yii::$app->request->post('authItems'); if (!is_array($items)) { throw new Exception('Invalid request.Params has Error. Please do not repeat this request again.'); } if ($items && models\RbacRoleTask::deleteRoleTask($id, $items)) { echo '删除授权成功'; } else { throw new Exception('删除授权失败'); } }