diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/DocumentToolbar.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/DocumentToolbar.java
index 52e4ecf62..11bff5977 100644
--- a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/DocumentToolbar.java
+++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/DocumentToolbar.java
@@ -484,7 +484,8 @@ private void addOffice() {
}
private void addOnlyOffice() {
- if (Feature.visible(Feature.ONLYOFFICE) && Menu.enabled(Menu.ONLYOFFICE) && Session.get().getConfigAsBoolean("converter.OnlyOfficeConverter.enabled")) {
+ if (Feature.visible(Feature.ONLYOFFICE) && Menu.enabled(Menu.ONLYOFFICE)
+ && Session.get().getConfigAsBoolean("converter.OnlyOfficeConverter.enabled")) {
addButton(onlyoffice);
onlyoffice.setTooltip(I18N.message("editwithonlyoffice"));
onlyoffice.setTitle("");
@@ -692,16 +693,10 @@ private void updateUsingDocument(GUIDocument document) {
else if (document.getType() != null)
isOfficeFile = Util.isOfficeFileType(document.getType());
- office.setDisabled(
- !Feature.enabled(Feature.OFFICE) || !isOfficeFile || !document.isDownload() || !document.isWrite());
+ office.setDisabled(!Feature.enabled(Feature.OFFICE) || !isOfficeFile || !document.isDownload()
+ || !document.isWrite() || document.getStatus() != Constants.DOC_UNLOCKED);
onlyoffice.setDisabled(!Feature.enabled(Feature.OFFICE) || !Menu.enabled(Menu.ONLYOFFICE)
- || !document.isDownload() || !document.isWrite());
- if (document.getStatus() != Constants.DOC_UNLOCKED && !Session.get().getUser().isMemberOf(Constants.GROUP_ADMIN)
- && document.getLockUserId() != null
- && Session.get().getUser().getId() != document.getLockUserId().longValue()) {
- office.setDisabled(true);
- onlyoffice.setDisabled(true);
- }
+ || !document.isDownload() || !document.isWrite() || document.getStatus() != Constants.DOC_UNLOCKED);
}
@Override
diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/grid/ContextMenu.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/grid/ContextMenu.java
index 382b565e3..67afe6c41 100644
--- a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/grid/ContextMenu.java
+++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/grid/ContextMenu.java
@@ -307,7 +307,7 @@ private void applySecurityPolicies(GUIAccessControlEntry allowedPermissions, fin
applyDownloadSecurity(allowedPermissions, someSelection, justOneSelected);
- applyOfficeSecurity(allowedPermissions, justOneSelected);
+ applyOfficeSecurity(allowedPermissions, selection, justOneSelected);
convert.setEnabled(justOneSelected && Feature.enabled(Feature.FORMAT_CONVERSION));
archive.setEnabled(someSelection && allowedPermissions.isArchive() && Feature.enabled(Feature.ARCHIVING));
@@ -334,9 +334,11 @@ private void applySplitSecurity(GUIAccessControlEntry enabledPermissions, List selection,
+ boolean justOneSelected) {
office.setEnabled(justOneSelected && Feature.enabled(Feature.OFFICE) && enabledPermissions.isWrite()
- && enabledPermissions.isDownload() && Util.isOfficeFile(grid.getSelectedDocument().getFileName()));
+ && enabledPermissions.isDownload() && Util.isOfficeFile(grid.getSelectedDocument().getFileName())
+ && checkStatusInSelection(Constants.DOC_UNLOCKED, selection));
}
private void applyDownloadSecurity(GUIAccessControlEntry enabledPermissions, boolean someSelection,