Example #1
0
 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\RbacTaskItems::deleteItemsToTask($id, $items)) {
         echo '删除授权成功';
     } else {
         throw new Exception('删除授权失败');
     }
 }
Example #2
0
 /**
  * 取消授权任务中的某条授权项目
  * @throws CHttpException
  */
 public function actionUnAssignTask($task_id, $authitems_name)
 {
     if (preg_match('/^\\d+$/', $task_id)) {
         models\RbacTaskItems::deleteItemsToTask($task_id, $authitems_name);
     }
     return $this->redirect(['/rbac/authitems/related-task', 'id' => $authitems_name]);
 }
Example #3
0
 /**
  * 删除扫描到的控制器的action(授权项)
  * @param  array $names 授权项name(主键)数组
  * @return integer
  */
 public static function deleteAuthItemByNames($names)
 {
     if (!is_array($names) || empty($names)) {
         return false;
     }
     // 先删除授权任务中的关联数据
     $result = RbacTaskItems::deleteAll(['in', 'authitems_name', $names]);
     // 再删除授权项
     return self::deleteAll(['in', 'item_name', $names]);
 }