From f41dafe76d7d4d07cfc81bb9b1f996c6728dd25f Mon Sep 17 00:00:00 2001 From: jendib Date: Sun, 8 May 2016 23:31:33 +0200 Subject: [PATCH 1/2] Theme images expiration date --- .../java/com/sismics/docs/rest/resource/ThemeResource.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs-web/src/main/java/com/sismics/docs/rest/resource/ThemeResource.java b/docs-web/src/main/java/com/sismics/docs/rest/resource/ThemeResource.java index 1b6fc464..82dc70d3 100644 --- a/docs-web/src/main/java/com/sismics/docs/rest/resource/ThemeResource.java +++ b/docs-web/src/main/java/com/sismics/docs/rest/resource/ThemeResource.java @@ -26,6 +26,8 @@ import java.io.OutputStream; import java.io.StringReader; import java.nio.file.Files; import java.nio.file.StandardCopyOption; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.Map; /** @@ -176,6 +178,7 @@ public class ThemeResource extends BaseResource { } }) .header("Content-Type", "image/*") + .header("Expires", new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z").format(new Date().getTime() + 3600000 * 24 * 15)) .build(); } From 3ff41d20024c86c12c4d689c28b6ea88c22985aa Mon Sep 17 00:00:00 2001 From: jendib Date: Sun, 8 May 2016 23:40:08 +0200 Subject: [PATCH 2/2] Fix inherited ACLs displayed on documents --- .../docs/rest/resource/DocumentResource.java | 6 ++++-- .../document/DocumentViewPermissions.js | 2 +- .../docs/document.view.permissions.html | 18 +++++++++--------- .../sismics/docs/rest/TestShareResource.java | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/docs-web/src/main/java/com/sismics/docs/rest/resource/DocumentResource.java b/docs-web/src/main/java/com/sismics/docs/rest/resource/DocumentResource.java index 555e4dc5..1f7bccbc 100644 --- a/docs-web/src/main/java/com/sismics/docs/rest/resource/DocumentResource.java +++ b/docs-web/src/main/java/com/sismics/docs/rest/resource/DocumentResource.java @@ -92,7 +92,7 @@ public class DocumentResource extends BaseResource { TagDao tagDao = new TagDao(); tagDtoList = tagDao.findByCriteria( new TagCriteria() - .setTargetIdList(getTargetIdList(shareId)) + .setTargetIdList(getTargetIdList(null)) // No tags for shares .setDocumentId(documentId), new SortCriteria(1, true)); JsonArrayBuilder tags = Json.createArrayBuilder(); @@ -270,7 +270,9 @@ public class DocumentResource extends BaseResource { for (DocumentDto documentDto : paginatedList.getResultList()) { // Get tags added by the current user on this document - List tagDtoList = tagDao.findByCriteria(new TagCriteria().setTargetIdList(getTargetIdList(null)).setDocumentId(documentDto.getId()), new SortCriteria(1, true)); + List tagDtoList = tagDao.findByCriteria(new TagCriteria() + .setTargetIdList(getTargetIdList(null)) + .setDocumentId(documentDto.getId()), new SortCriteria(1, true)); JsonArrayBuilder tags = Json.createArrayBuilder(); for (TagDto tagDto : tagDtoList) { tags.add(Json.createObjectBuilder() diff --git a/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentViewPermissions.js b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentViewPermissions.js index cb953fcf..453605df 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentViewPermissions.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentViewPermissions.js @@ -7,7 +7,7 @@ angular.module('docs').controller('DocumentViewPermissions', function($scope) { // Watch for ACLs change and group them for easy displaying $scope.$watch('document.inherited_acls', function(acls) { $scope.inheritedAcls = _.groupBy(acls, function(acl) { - return acl.id; + return acl.source_id; }); }); }); \ No newline at end of file diff --git a/docs-web/src/main/webapp/src/partial/docs/document.view.permissions.html b/docs-web/src/main/webapp/src/partial/docs/document.view.permissions.html index 7c4401f5..701387a5 100644 --- a/docs-web/src/main/webapp/src/partial/docs/document.view.permissions.html +++ b/docs-web/src/main/webapp/src/partial/docs/document.view.permissions.html @@ -1,5 +1,14 @@

Permissions can be applied directly to this document, or can come from tags.

+
+

Permissions on this document

+ + +
+

Permissions inherited by tags

@@ -25,13 +34,4 @@ -
- -
-

Permissions on this document

- -
\ No newline at end of file diff --git a/docs-web/src/test/java/com/sismics/docs/rest/TestShareResource.java b/docs-web/src/test/java/com/sismics/docs/rest/TestShareResource.java index 959e9dd3..5dc86364 100644 --- a/docs-web/src/test/java/com/sismics/docs/rest/TestShareResource.java +++ b/docs-web/src/test/java/com/sismics/docs/rest/TestShareResource.java @@ -47,7 +47,7 @@ public class TestShareResource extends BaseJerseyTest { Assert.assertNotNull(document1Id); // Add a file - String file1Id = null; + String file1Id; try (InputStream is = Resources.getResource("file/PIA00452.jpg").openStream()) { StreamDataBodyPart streamDataBodyPart = new StreamDataBodyPart("file", is, "PIA00452.jpg"); try (FormDataMultiPart multiPart = new FormDataMultiPart()) {