Skip to content

Commit

Permalink
Merge pull request #122 from ONLYOFFICE/hotfix/convert-action
Browse files Browse the repository at this point in the history
Hotfix/convert action
  • Loading branch information
LinneyS authored Oct 18, 2021
2 parents ba9f59d + de426f4 commit 5cbeae9
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 44 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

# 5.0.1
## Fixed
- error on the "Document Details" page when the "Convert with ONLYOFFICE" button is displayed [#121](https://github.com/ONLYOFFICE/onlyoffice-alfresco/issues/121)

# 5.0.0
## Added
- connection to the demo server
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.onlyoffice.alfresco</groupId>
<artifactId>onlyoffice-integration</artifactId>
<version>5.0.0</version>
<version>5.0.1</version>
<name>ONLYOFFICE Alfresco Integration</name>
<description>This Module integrates Alfresco Share with ONLYOFFICE</description>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion repo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>com.onlyoffice.alfresco</groupId>
<artifactId>onlyoffice-integration</artifactId>
<version>5.0.0</version>
<version>5.0.1</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion share/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>com.onlyoffice.alfresco</groupId>
<artifactId>onlyoffice-integration</artifactId>
<version>5.0.0</version>
<version>5.0.1</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,34 @@ public void setOnlyofficeSettings(OnlyofficeSettingsQuery onlyofficeSettings) {

@Override
public boolean evaluate(JSONObject jsonObject) {
try
{
try {
if (onlyofficeSettings.getConvertOriginal()) {
JSONObject node = (JSONObject)jsonObject.get("node");
if (node == null)
{
return false;
}
else
{
if (node != null && node.containsKey("permissions")) {
JSONObject perm = (JSONObject)node.get("permissions");
JSONObject user = (JSONObject)perm.get("user");
return (boolean)user.getOrDefault("Write", false);
if (perm != null && perm.containsKey("user")) {
JSONObject user = (JSONObject)perm.get("user");
if (user != null && (boolean)user.getOrDefault("Write", false)) {
return true;
}
}
}
} else {
JSONObject parent = (JSONObject)jsonObject.get("parent");
if (parent == null)
{
return false;
}
else
{
if (parent != null && parent.containsKey("permissions")) {
JSONObject perm = (JSONObject)parent.get("permissions");
JSONObject user = (JSONObject)perm.get("user");
return (boolean)user.getOrDefault("CreateChildren", false);
if (perm != null && perm.containsKey("user")) {
JSONObject user = (JSONObject)perm.get("user");
if (user != null && (boolean)user.getOrDefault("CreateChildren", false)) {
return true;
}
}
}
}
}
catch (Exception err)
{
throw new AlfrescoRuntimeException("Failed to run action evaluator: " + err.getMessage());

return false;
} catch (Exception err) {
throw new AlfrescoRuntimeException("Failed to run action evaluator", err);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public boolean evaluate(JSONObject jsonObject)
}
catch (Exception err)
{
throw new AlfrescoRuntimeException("Failed to run action evaluator: " + err.getMessage());
throw new AlfrescoRuntimeException("Failed to run action evaluator", err);
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public boolean evaluate(JSONObject jsonObject) {

return false;
} catch (Exception err) {
throw new AlfrescoRuntimeException("Failed to run action evaluator: " + err.getMessage());
throw new AlfrescoRuntimeException("Failed to run action evaluator", err);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public boolean evaluate(JSONObject jsonObject) {
}
catch (Exception err)
{
throw new AlfrescoRuntimeException("Failed to run action evaluator: " + err.getMessage());
throw new AlfrescoRuntimeException("Failed to run action evaluator", err);
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,21 @@ public class IsWritePermission extends BaseEvaluator {

@Override
public boolean evaluate(JSONObject jsonObject) {
try
{
try {
JSONObject node = (JSONObject)jsonObject.get("node");
if (node == null)
{
return false;
}
else
{
if (node != null && node.containsKey("permissions")){
JSONObject perm = (JSONObject)node.get("permissions");
JSONObject user = (JSONObject)perm.get("user");
return (boolean)user.getOrDefault("Write", false);
if (perm != null && perm.containsKey("user")) {
JSONObject user = (JSONObject) perm.get("user");
if (user != null && (boolean) user.getOrDefault("Write", false)) {
return true;
}
}
}
}
catch (Exception err)
{
throw new AlfrescoRuntimeException("Failed to run action evaluator: " + err.getMessage());

return false;
} catch (Exception err) {
throw new AlfrescoRuntimeException("Failed to run action evaluator", err);
}
}

}

0 comments on commit 5cbeae9

Please sign in to comment.