Document sharing (client), better state handling for file view

This commit is contained in:
jendib
2013-08-15 15:23:41 +02:00
parent ed85909d00
commit ea1e226b50
11 changed files with 134 additions and 52 deletions
@@ -182,11 +182,15 @@ public class FileResource extends BaseResource {
authenticate();
// Check document visibility
DocumentDao documentDao = new DocumentDao();
Document document = documentDao.getDocument(documentId);
ShareDao shareDao = new ShareDao();
if (!shareDao.checkVisibility(document, principal.getId(), shareId)) {
throw new ForbiddenClientException();
try {
DocumentDao documentDao = new DocumentDao();
Document document = documentDao.getDocument(documentId);
ShareDao shareDao = new ShareDao();
if (!shareDao.checkVisibility(document, principal.getId(), shareId)) {
throw new ForbiddenClientException();
}
} catch (NoResultException e) {
throw new ClientException("DocumentNotFound", MessageFormat.format("Document not found: {0}", documentId));
}
FileDao fileDao = new FileDao();