Merge pull request #96 from sismics/master

Push to production
This commit is contained in:
Benjamin Gamard 2016-05-08 23:40:50 +02:00
commit 6b57d29f51
5 changed files with 18 additions and 13 deletions

View File

@ -92,7 +92,7 @@ public class DocumentResource extends BaseResource {
TagDao tagDao = new TagDao(); TagDao tagDao = new TagDao();
tagDtoList = tagDao.findByCriteria( tagDtoList = tagDao.findByCriteria(
new TagCriteria() new TagCriteria()
.setTargetIdList(getTargetIdList(shareId)) .setTargetIdList(getTargetIdList(null)) // No tags for shares
.setDocumentId(documentId), .setDocumentId(documentId),
new SortCriteria(1, true)); new SortCriteria(1, true));
JsonArrayBuilder tags = Json.createArrayBuilder(); JsonArrayBuilder tags = Json.createArrayBuilder();
@ -270,7 +270,9 @@ public class DocumentResource extends BaseResource {
for (DocumentDto documentDto : paginatedList.getResultList()) { for (DocumentDto documentDto : paginatedList.getResultList()) {
// Get tags added by the current user on this document // Get tags added by the current user on this document
List<TagDto> tagDtoList = tagDao.findByCriteria(new TagCriteria().setTargetIdList(getTargetIdList(null)).setDocumentId(documentDto.getId()), new SortCriteria(1, true)); List<TagDto> tagDtoList = tagDao.findByCriteria(new TagCriteria()
.setTargetIdList(getTargetIdList(null))
.setDocumentId(documentDto.getId()), new SortCriteria(1, true));
JsonArrayBuilder tags = Json.createArrayBuilder(); JsonArrayBuilder tags = Json.createArrayBuilder();
for (TagDto tagDto : tagDtoList) { for (TagDto tagDto : tagDtoList) {
tags.add(Json.createObjectBuilder() tags.add(Json.createObjectBuilder()

View File

@ -26,6 +26,8 @@ import java.io.OutputStream;
import java.io.StringReader; import java.io.StringReader;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map; import java.util.Map;
/** /**
@ -176,6 +178,7 @@ public class ThemeResource extends BaseResource {
} }
}) })
.header("Content-Type", "image/*") .header("Content-Type", "image/*")
.header("Expires", new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z").format(new Date().getTime() + 3600000 * 24 * 15))
.build(); .build();
} }

View File

@ -7,7 +7,7 @@ angular.module('docs').controller('DocumentViewPermissions', function($scope) {
// Watch for ACLs change and group them for easy displaying // Watch for ACLs change and group them for easy displaying
$scope.$watch('document.inherited_acls', function(acls) { $scope.$watch('document.inherited_acls', function(acls) {
$scope.inheritedAcls = _.groupBy(acls, function(acl) { $scope.inheritedAcls = _.groupBy(acls, function(acl) {
return acl.id; return acl.source_id;
}); });
}); });
}); });

View File

@ -1,5 +1,14 @@
<p class="well-sm">Permissions can be applied directly to this document, or can come from <a href="#/tag">tags</a>.</p> <p class="well-sm">Permissions can be applied directly to this document, or can come from <a href="#/tag">tags</a>.</p>
<div class="well">
<h3>Permissions on this document</h3>
<acl-edit source="document.id"
acls="document.acls"
writable="document.writable"
creator="document.creator"></acl-edit>
</div>
<div class="well" ng-show="document.inherited_acls.length > 0"> <div class="well" ng-show="document.inherited_acls.length > 0">
<h3>Permissions inherited by tags</h3> <h3>Permissions inherited by tags</h3>
@ -25,13 +34,4 @@
</td> </td>
</tr> </tr>
</table> </table>
</div>
<div class="well">
<h3>Permissions on this document</h3>
<acl-edit source="document.id"
acls="document.acls"
writable="document.writable"
creator="document.creator"></acl-edit>
</div> </div>

View File

@ -47,7 +47,7 @@ public class TestShareResource extends BaseJerseyTest {
Assert.assertNotNull(document1Id); Assert.assertNotNull(document1Id);
// Add a file // Add a file
String file1Id = null; String file1Id;
try (InputStream is = Resources.getResource("file/PIA00452.jpg").openStream()) { try (InputStream is = Resources.getResource("file/PIA00452.jpg").openStream()) {
StreamDataBodyPart streamDataBodyPart = new StreamDataBodyPart("file", is, "PIA00452.jpg"); StreamDataBodyPart streamDataBodyPart = new StreamDataBodyPart("file", is, "PIA00452.jpg");
try (FormDataMultiPart multiPart = new FormDataMultiPart()) { try (FormDataMultiPart multiPart = new FormDataMultiPart()) {