From d5f5079c22da920f2b6c659599623fe13cc6e04d Mon Sep 17 00:00:00 2001 From: Oleg Sinizin Date: Thu, 29 Jul 2021 12:30:48 +0300 Subject: [PATCH] java-spring: remove templates field from Permissions, fix version history --- .../integration/controllers/IndexController.java | 8 ++++---- .../integration/entities/filemodel/Permission.java | 9 --------- .../onlyoffice/integration/services/UserServices.java | 4 +--- .../java-spring/src/main/resources/templates/editor.html | 9 +++++---- 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/controllers/IndexController.java b/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/controllers/IndexController.java index 6da747c7..fbf3349d 100755 --- a/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/controllers/IndexController.java +++ b/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/controllers/IndexController.java @@ -100,15 +100,15 @@ public class IndexController { description_user_1, null, List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()), - List.of(FilterState.NULL.toString()),true); + List.of(FilterState.NULL.toString())); userService.createUser("Mark Pottato", "pottato@mail.ru", description_user_2, "group-2", List.of("","group-2"), List.of(FilterState.NULL.toString()), - List.of("group-2", ""), List.of("group-2"),false); + List.of("group-2", ""), List.of("group-2")); userService.createUser("Hamish Mitchell", "mitchell@mail.ru", description_user_3, "group-3", List.of("group-2"), List.of("group-2", "group-3"), - List.of("group-2"), new ArrayList<>(),false); + List.of("group-2"), new ArrayList<>()); userService.createUser("Anonymous",null,description_user_0,null, - List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),null); + List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString())); } diff --git a/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/entities/filemodel/Permission.java b/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/entities/filemodel/Permission.java index d09a5b83..d2012b20 100755 --- a/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/entities/filemodel/Permission.java +++ b/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/entities/filemodel/Permission.java @@ -44,7 +44,6 @@ public class Permission { private Boolean modifyFilter = true; private Boolean modifyContentControl = true; private Boolean review = true; - private Boolean templates = true; @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = SerializerFilter.class) private List reviewGroups; private CommentGroup commentGroups; @@ -71,7 +70,6 @@ public class Permission { .distinct() .map(group -> group.getName()) .collect(Collectors.toList()); - this.templates = user.getPermissions().getTemplates() ? true : null; List commentViewGroups = user.getPermissions().getCommentsViewGroups(); List commentEditGroups = user.getPermissions().getCommentsEditGroups(); List commentRemoveGroups = user.getPermissions().getCommentsRemoveGroups(); @@ -167,11 +165,4 @@ public class Permission { this.commentGroups = commentGroups; } - public Boolean getTemplates() { - return templates; - } - - public void setTemplates(Boolean templates) { - this.templates = templates; - } } diff --git a/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/services/UserServices.java b/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/services/UserServices.java index 65bb696f..49d469ee 100755 --- a/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/services/UserServices.java +++ b/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/services/UserServices.java @@ -60,8 +60,7 @@ public class UserServices { List reviewGroups, List viewGroups, List editGroups, - List removeGroups, - Boolean templates){ + List removeGroups){ User newUser = new User(); newUser.setName(name); newUser.setEmail(email); @@ -75,7 +74,6 @@ public class UserServices { Permission permission = permissionService .createPermission(groupsReview, commentGroupsView, commentGroupsEdit, commentGroupsRemove); - permission.setTemplates(templates); newUser.setPermissions(permission); userRepository.save(newUser); diff --git a/web/documentserver-example/java-spring/src/main/resources/templates/editor.html b/web/documentserver-example/java-spring/src/main/resources/templates/editor.html index 21b6527d..28cd2d11 100755 --- a/web/documentserver-example/java-spring/src/main/resources/templates/editor.html +++ b/web/documentserver-example/java-spring/src/main/resources/templates/editor.html @@ -120,13 +120,14 @@ }; var histArray = [[${model.GetHistory()}]]; - var history = histArray[0]; - var historyData = histArray[1]; + var hist = JSON.parse(histArray[0]); + var historyData = JSON.parse(histArray[1]); var usersForMentions = [[${usersForMentions}]]; + console.log(hist); - if (history && historyData) { + if (hist && historyData) { config.events['onRequestHistory'] = function () { - docEditor.refreshHistory(history); + docEditor.refreshHistory(hist); }; config.events['onRequestHistoryData'] = function (event) { var ver = event.data;