|
19 | 19 |
|
20 | 20 | package org.apache.iotdb.db.pipe.source.schemaregion; |
21 | 21 |
|
| 22 | +import org.apache.iotdb.commons.auth.entity.PrivilegeType; |
| 23 | +import org.apache.iotdb.commons.conf.IoTDBConstant; |
22 | 24 | import org.apache.iotdb.commons.consensus.SchemaRegionId; |
23 | 25 | import org.apache.iotdb.commons.exception.IllegalPathException; |
24 | 26 | import org.apache.iotdb.commons.exception.auth.AccessDeniedException; |
|
53 | 55 | import org.apache.iotdb.pipe.api.customizer.configuration.PipeExtractorRuntimeConfiguration; |
54 | 56 | import org.apache.iotdb.pipe.api.customizer.parameter.PipeParameters; |
55 | 57 | import org.apache.iotdb.pipe.api.exception.PipeException; |
| 58 | +import org.apache.iotdb.rpc.TSStatusCode; |
| 59 | + |
| 60 | +import org.apache.tsfile.common.constant.TsFileConstant; |
56 | 61 |
|
57 | 62 | import java.io.IOException; |
58 | 63 | import java.nio.file.Paths; |
| 64 | +import java.util.Collections; |
59 | 65 | import java.util.HashSet; |
60 | 66 | import java.util.Objects; |
61 | 67 | import java.util.Optional; |
@@ -167,9 +173,20 @@ protected boolean canSkipSnapshotPrivilegeCheck(final PipeSnapshotEvent event) { |
167 | 173 | if (PathUtils.isTableModelDatabase(database)) { |
168 | 174 | AuthorityChecker.getAccessControl() |
169 | 175 | .checkCanSelectFromDatabase4Pipe(userName, database, userEntity); |
| 176 | + return true; |
170 | 177 | } |
171 | | - return true; |
172 | | - } catch (final AccessDeniedException e) { |
| 178 | + return AuthorityChecker.getAccessControl() |
| 179 | + .checkSeriesPrivilege4Pipe( |
| 180 | + userEntity, |
| 181 | + Collections.singletonList( |
| 182 | + new PartialPath( |
| 183 | + database |
| 184 | + + TsFileConstant.PATH_SEPARATOR |
| 185 | + + IoTDBConstant.MULTI_LEVEL_PATH_WILDCARD)), |
| 186 | + PrivilegeType.READ_SCHEMA) |
| 187 | + .getCode() |
| 188 | + == TSStatusCode.SUCCESS_STATUS.getStatusCode(); |
| 189 | + } catch (final AccessDeniedException | IllegalPathException e) { |
173 | 190 | return false; |
174 | 191 | } |
175 | 192 | } |
|
0 commit comments