diff --git a/ajax/sessionController.php b/ajax/sessionController.php
index f477dea4..3aa9f49e 100644
--- a/ajax/sessionController.php
+++ b/ajax/sessionController.php
@@ -35,11 +35,7 @@ class SessionController extends Controller{
$session = Session::add($genesisPath, $hash, $fileId);
}
- $session['permissions'] = \OCP\PERMISSION_READ;
- if (\OC\Files\Filesystem::isSharable($path)) {
- $session['permissions'] |= \OCP\PERMISSION_SHARE;
- }
-
+ $session['permissions'] = View::getFilePermissions($path);
$session['member_id'] = (string) Member::add($session['es_id'], $uid, Helper::getRandomColor());
\OCP\JSON::success($session);
exit();
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 9dfdaed7..c0098dbc 100755
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -7,4 +7,7 @@
Frank Karlitschek
5.0.19
true
+
+ public.php
+
diff --git a/appinfo/version b/appinfo/version
index 490f510f..7ceb0404 100755
--- a/appinfo/version
+++ b/appinfo/version
@@ -1 +1 @@
-0.6
\ No newline at end of file
+0.6.1
\ No newline at end of file
diff --git a/index.php b/index.php
index 7eb3802b..afd4477b 100755
--- a/index.php
+++ b/index.php
@@ -30,7 +30,7 @@ namespace OCA\Documents;
\OCP\Util::addStyle( 'documents', 'style' );
\OCP\Util::addStyle( 'documents', '3rdparty/webodf/dojo-app');
-\OCP\Util::addStyle( 'documents', '3rdparty/webodf/editor' );
+\OCP\Util::addStyle( 'documents', '3rdparty/webodf/editor');
\OCP\Util::addScript('documents', 'documents');
\OCP\Util::addScript('files', 'file-upload');
diff --git a/js/documents.js b/js/documents.js
index 92bd9ea6..3869a07e 100644
--- a/js/documents.js
+++ b/js/documents.js
@@ -90,7 +90,9 @@ var documentsMain = {
documentsMain.UI.init();
// Does anything indicate that we need to autostart a session?
- var fileId = parent.location.hash.replace(/\W*/g, '');
+ var fileId = parent.location.hash.replace(/\W*/g, '')
+ || $("[name='document']").val()
+ ;
if (!fileId){
documentsMain.show();
} else {
@@ -231,6 +233,10 @@ var documentsMain = {
},
show: function(){
+ if (!OC.currentUser){
+ return;
+ }
+
jQuery.when(documentsMain.loadDocuments())
.then(function(){
documentsMain.renderDocuments();
diff --git a/lib/storage.php b/lib/storage.php
index cd1dbf4f..bc3decc0 100755
--- a/lib/storage.php
+++ b/lib/storage.php
@@ -58,7 +58,7 @@ class Storage {
throw new \Exception($fileId . ' can not be resolved');
}
- $internalPath = preg_replace('/^\/?files/', '', $path);
+ $internalPath = preg_replace('/^\/?files\//', '', $path);
if (!\OC\Files\Filesystem::file_exists($internalPath)){
$sharedInfo = \OCP\Share::getItemSharedWithBySource(
'file',
diff --git a/lib/view.php b/lib/view.php
index 90e61fed..575eebcf 100644
--- a/lib/view.php
+++ b/lib/view.php
@@ -30,6 +30,18 @@ class View extends \OC\Files\View{
return new \OC\Files\View('/' . $uid . self::DOCUMENTS_DIRNAME);
}
+ public static function getFilePermissions($path){
+ $view = new \OC\Files\View('/' . \OCP\User::getUser());
+ $permissions = 0;
+ if ($view->isReadable($path)) {
+ $permissions |= \OCP\PERMISSION_READ;
+ }
+ if ($view->isSharable($path)) {
+ $permissions |= \OCP\PERMISSION_SHARE;
+ }
+ return $permissions;
+ }
+
public static function storeDocument($uid, $filePath){
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
diff --git a/public.php b/public.php
new file mode 100644
index 00000000..7553ed5b
--- /dev/null
+++ b/public.php
@@ -0,0 +1,46 @@
+assign('document', $rootLinkItem['file_source']);
+} else {
+ // TODO: show nice 404 page
+}
+
+$tmpl->printPage();
diff --git a/templates/public.php b/templates/public.php
new file mode 100644
index 00000000..5d5edba1
--- /dev/null
+++ b/templates/public.php
@@ -0,0 +1,5 @@
+
+
+
+
+