Skip to content

Commit 763734b

Browse files
committed
bugfix: share api bug fix
1 parent c2bc95c commit 763734b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/src/main/java/datart/server/service/impl/ShareServiceImpl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ public ShareVizDetail getShareViz(ShareToken shareToken) {
203203

204204
@Override
205205
public Dataframe execute(ShareToken shareToken, ViewExecuteParam executeParam) throws Exception {
206-
validateExecutePermission(shareToken.getAuthorizedToken(), executeParam);
206+
ShareAuthorizedToken shareAuthorizedToken = validateExecutePermission(shareToken.getAuthorizedToken(), executeParam);
207+
getSecurityManager().runAs(shareAuthorizedToken.getPermissionBy());
207208
return dataProviderService.execute(executeParam, false);
208209
}
209210

@@ -332,14 +333,15 @@ public boolean update(BaseUpdateParam updateParam) {
332333
return 1 == shareMapper.updateByPrimaryKey(update);
333334
}
334335

335-
private void validateExecutePermission(String authorizedToken, ViewExecuteParam executeParam) {
336+
private ShareAuthorizedToken validateExecutePermission(String authorizedToken, ViewExecuteParam executeParam) {
336337
if (StringUtils.isBlank(authorizedToken)) {
337338
Exceptions.tr(PermissionDeniedException.class, "message.provider.execute.permission.denied");
338339
}
339340
ShareAuthorizedToken shareAuthorizedToken = AESUtil.decrypt(authorizedToken, Application.getTokenSecret(), ShareAuthorizedToken.class);
340341
if (!ResourceType.VIEW.equals(shareAuthorizedToken.getVizType()) || !shareAuthorizedToken.getVizId().equals(executeParam.getViewId())) {
341342
Exceptions.tr(PermissionDeniedException.class, "message.provider.execute.permission.denied");
342343
}
344+
return shareAuthorizedToken;
343345
}
344346

345347
private void validateExpiration(ShareAuthorizedToken share) {

0 commit comments

Comments
 (0)