|
21 | 21 |
|
22 | 22 | import org.apache.iotdb.common.rpc.thrift.TSStatus; |
23 | 23 | import org.apache.iotdb.commons.auth.entity.PrivilegeType; |
| 24 | +import org.apache.iotdb.commons.conf.IoTDBConstant; |
24 | 25 | import org.apache.iotdb.commons.path.PartialPath; |
25 | 26 | import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; |
26 | 27 | import org.apache.iotdb.db.auth.AuthorityChecker; |
|
44 | 45 | import java.util.ArrayList; |
45 | 46 | import java.util.Collections; |
46 | 47 | import java.util.List; |
| 48 | +import java.util.Objects; |
47 | 49 |
|
48 | 50 | /** CREATE LOGICAL VIEW statement. */ |
49 | 51 | public class CreateLogicalViewStatement extends Statement { |
@@ -99,11 +101,18 @@ public TSStatus checkPermissionBeforeProcess(String userName) { |
99 | 101 | PrivilegeType.READ_SCHEMA); |
100 | 102 | } |
101 | 103 |
|
| 104 | + final List<PartialPath> paths = |
| 105 | + Objects.nonNull(getTargetPathList()) |
| 106 | + ? getTargetPathList() |
| 107 | + : Collections.singletonList( |
| 108 | + batchGenerationItem |
| 109 | + .getIntoDevice() |
| 110 | + .concatNode(IoTDBConstant.ONE_LEVEL_PATH_WILDCARD)); |
102 | 111 | if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { |
103 | 112 | return AuthorityChecker.getTSStatus( |
104 | 113 | AuthorityChecker.checkFullPathOrPatternListPermission( |
105 | | - userName, getTargetPathList(), PrivilegeType.WRITE_SCHEMA), |
106 | | - getTargetPathList(), |
| 114 | + userName, paths, PrivilegeType.WRITE_SCHEMA), |
| 115 | + paths, |
107 | 116 | PrivilegeType.WRITE_SCHEMA); |
108 | 117 | } |
109 | 118 | return status; |
|
0 commit comments