[
https://issues.apache.org/jira/browse/KYLIN-1909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15427959#comment-15427959
]
julian pan commented on KYLIN-1909:
-----------------------------------
diff --git
a/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
b/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
index 7932211..133fdbc 100644
---
a/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
+++
b/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
@@ -21,6 +21,7 @@
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -97,7 +98,21 @@
@RequestMapping(value = "", method = { RequestMethod.GET })
@ResponseBody
public List<CubeInstance> getCubes(@RequestParam(value = "cubeName",
required = false) String cubeName, @RequestParam(value = "modelName", required
= false) String modelName, @RequestParam(value = "projectName", required =
false) String projectName, @RequestParam(value = "limit", required = false)
Integer limit, @RequestParam(value = "offset", required = false) Integer
offset) {
- return cubeService.getCubes(cubeName, projectName, modelName, limit,
offset);
+ List<CubeInstance> cubes;
+ cubes = cubeService.getCubes(cubeName, projectName, modelName);
+
+ int climit = (null == limit) ? cubes.size() : limit;
+ int coffset = (null == offset) ? 0 : offset;
+
+ if (cubes.size() <= coffset) {
+ return Collections.emptyList();
+ }
+
+ if ((cubes.size() - coffset) < climit) {
+ return cubes.subList(coffset, cubes.size());
+ }
+
+ return cubes.subList(coffset, coffset + climit);
}
@RequestMapping(value = "validEncodings", method = { RequestMethod.GET })
diff --git
a/server-base/src/main/java/org/apache/kylin/rest/service/CubeService.java
b/server-base/src/main/java/org/apache/kylin/rest/service/CubeService.java
index cfb4cf8..030ff22 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/service/CubeService.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/service/CubeService.java
@@ -93,7 +93,7 @@
private AccessService accessService;
@PostFilter(Constant.ACCESS_POST_FILTER_READ)
- public List<CubeInstance> listAllCubes(final String cubeName, final String
projectName, final String modelName) {
+ public List<CubeInstance> getCubes(final String cubeName, final String
projectName, final String modelName) {
List<CubeInstance> cubeInstances = null;
ProjectInstance project = (null != projectName) ?
getProjectManager().getProject(projectName) : null;
@@ -126,26 +126,6 @@
}
return filterCubes;
- }
-
- @PostFilter(Constant.ACCESS_POST_FILTER_READ)
- public List<CubeInstance> getCubes(final String cubeName, final String
projectName, final String modelName, final Integer limit, final Integer offset)
{
-
- List<CubeInstance> cubes;
- cubes = listAllCubes(cubeName, projectName, modelName);
-
- int climit = (null == limit) ? cubes.size() : limit;
- int coffset = (null == offset) ? 0 : offset;
-
- if (cubes.size() <= coffset) {
- return Collections.emptyList();
- }
-
- if ((cubes.size() - coffset) < climit) {
- return cubes.subList(coffset, cubes.size());
- }
-
- return cubes.subList(coffset, coffset + climit);
}
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#cube,
'ADMINISTRATION') or hasPermission(#cube, 'MANAGEMENT')")
> Wrong access control to rest get cubes
> --------------------------------------
>
> Key: KYLIN-1909
> URL: https://issues.apache.org/jira/browse/KYLIN-1909
> Project: Kylin
> Issue Type: Bug
> Components: REST Service
> Affects Versions: v1.5.2
> Reporter: Dong Li
> Assignee: Shaofeng SHI
> Priority: Minor
> Fix For: v1.5.3
>
>
> 1. Import sample data
> 2. Login with user: ANALYST, see nothing
> 3. Request rest api:
> http://sandbox:7070/kylin/api/cubes?limit=15&offset=0&projectName=learn_kylin
> Then found the list of cubes.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)