/**
  * 删除一个角色 & 所有该角色的用户分配
  */
 public function actionDeleteOneRole()
 {
     try {
         $roleId = Yii::$app->request->post(RoleModel::COL_ID);
         RoleModel::checkId($roleId);
         $result = RoleAssignModel::deleteAllByRoleId($roleId);
         if (!$result) {
         }
         $result = RoleModel::deleteOne($roleId);
         return Utils::handlerForResult($result);
     } catch (JdbRbacException $e) {
         return Utils::handlerForException($e);
     }
 }
Beispiel #2
0
 public static function deleteOne($roleId)
 {
     return RoleModel::deleteAll('id = :id', [':id' => $roleId]);
 }