In case a page is opened in edit mode, it should open with permission of MANAGE_PAGE. In case the user is a viewer, the page must not open.
This commit is contained in:
parent
e9086c15b5
commit
e5282dac11
|
|
@ -56,6 +56,14 @@ public class PageController extends BaseController<PageService, Page, String> {
|
|||
.map(resources -> new ResponseDTO<>(HttpStatus.OK.value(), resources, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping("/{pageId}")
|
||||
public Mono<ResponseDTO<Page>> getById(@PathVariable String pageId) {
|
||||
return applicationPageService.getPage(pageId, false)
|
||||
.map(page -> new ResponseDTO<>(HttpStatus.OK.value(), page, null));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/{pageId}/view")
|
||||
public Mono<ResponseDTO<Page>> getPageView(@PathVariable String pageId) {
|
||||
return applicationPageService.getPage(pageId, true)
|
||||
|
|
|
|||
|
|
@ -118,7 +118,8 @@ public class ApplicationPageServiceImpl implements ApplicationPageService {
|
|||
}
|
||||
|
||||
public Mono<Page> getPage(String pageId, Boolean viewMode) {
|
||||
return pageService.findById(pageId, READ_PAGES)
|
||||
AclPermission permission = viewMode ? READ_PAGES : MANAGE_PAGES;
|
||||
return pageService.findById(pageId, permission)
|
||||
.switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.PAGE_ID)))
|
||||
.map(page -> {
|
||||
List<Layout> layoutList = page.getLayouts();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user