Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVictor Dubiniuk <victor.dubiniuk@gmail.com>2014-11-11 03:22:31 +0300
committerVictor Dubiniuk <victor.dubiniuk@gmail.com>2014-11-11 03:42:49 +0300
commit932684b7829eec1276202231e6ebe4bc04458468 (patch)
tree8634b7c14a0c91fb58bfe1511034f7c1d1e2161b /lib
parent4fad41db457f14b506bf2a7299184824092d0d01 (diff)
Remove View model. Get permissions from FileInfo
Diffstat (limited to 'lib')
-rw-r--r--lib/db/session.php3
-rw-r--r--lib/downloadresponse.php1
-rw-r--r--lib/file.php2
-rw-r--r--lib/genesis.php6
-rw-r--r--lib/view.php27
5 files changed, 9 insertions, 30 deletions
diff --git a/lib/db/session.php b/lib/db/session.php
index e28c5e9b..f0eac207 100644
--- a/lib/db/session.php
+++ b/lib/db/session.php
@@ -103,7 +103,8 @@ class Session extends \OCA\Documents\Db {
}
$sessionData['title'] = basename($path);
- $sessionData['permissions'] = $ownerView->getFilePermissions($path);
+ $fileInfo = $ownerView->getFileInfo($path);
+ $sessionData['permissions'] = $fileInfo->getPermissions();
return $sessionData;
}
diff --git a/lib/downloadresponse.php b/lib/downloadresponse.php
index 8c21d674..a37ee32b 100644
--- a/lib/downloadresponse.php
+++ b/lib/downloadresponse.php
@@ -13,6 +13,7 @@ namespace OCA\Documents;
use \OCP\AppFramework\Http;
use \OCP\IRequest;
+use \OC\Files\View;
class DownloadResponse extends \OCP\AppFramework\Http\Response {
private $request;
diff --git a/lib/file.php b/lib/file.php
index 348e4cb9..c3f4b42f 100644
--- a/lib/file.php
+++ b/lib/file.php
@@ -22,6 +22,8 @@
namespace OCA\Documents;
+use \OC\Files\View;
+
class File {
protected $fileId;
protected $owner;
diff --git a/lib/genesis.php b/lib/genesis.php
index 65a92942..f030f374 100644
--- a/lib/genesis.php
+++ b/lib/genesis.php
@@ -22,6 +22,8 @@
namespace OCA\Documents;
+use \OC\Files\View;
+
class Genesis {
const DOCUMENTS_DIRNAME='/documents';
@@ -37,7 +39,7 @@ class Genesis {
* Create new genesis document
* @param File $file
* */
- public function __construct(\OCA\Documents\File $file){
+ public function __construct(File $file){
list($view, $path) = $file->getOwnerViewAndPath();
$owner = $file->getOwner();
@@ -96,7 +98,7 @@ class Genesis {
/**
* Check if genesis is valid
- * @param OCA\Documents\View $view
+ * @param \OC\Files\View $view
* @param string $path relative to the view
* @throws \Exception
*/
diff --git a/lib/view.php b/lib/view.php
deleted file mode 100644
index 3250b19e..00000000
--- a/lib/view.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-/**
- * ownCloud - Documents App
- *
- * @author Victor Dubiniuk
- * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- */
-
-namespace OCA\Documents;
-
-class View extends \OC\Files\View{
-
- public function getFilePermissions($path){
- $permissions = 0;
- if ($this->isReadable($path)) {
- $permissions |= \OCP\PERMISSION_READ;
- }
- if ($this->isSharable($path)) {
- $permissions |= \OCP\PERMISSION_SHARE;
- }
- return $permissions;
- }
-
-}