@@ -30,34 +30,34 @@ |
||
| 30 | 30 | |
| 31 | 31 | class RootCollection extends AbstractPrincipalCollection { |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * This method returns a node for a principal. |
|
| 35 | - * |
|
| 36 | - * The passed array contains principal information, and is guaranteed to |
|
| 37 | - * at least contain a uri item. Other properties may or may not be |
|
| 38 | - * supplied by the authentication backend. |
|
| 39 | - * |
|
| 40 | - * @param array $principalInfo |
|
| 41 | - * @return INode |
|
| 42 | - */ |
|
| 43 | - function getChildForPrincipal(array $principalInfo) { |
|
| 44 | - list(,$name) = \Sabre\Uri\split($principalInfo['uri']); |
|
| 45 | - $user = \OC::$server->getUserSession()->getUser(); |
|
| 46 | - if (is_null($user) || $name !== $user->getUID()) { |
|
| 47 | - // a user is only allowed to see their own home contents, so in case another collection |
|
| 48 | - // is accessed, we return a simple empty collection for now |
|
| 49 | - // in the future this could be considered to be used for accessing shared files |
|
| 50 | - return new SimpleCollection($name); |
|
| 51 | - } |
|
| 52 | - $userFolder = \OC::$server->getUserFolder(); |
|
| 53 | - if (!($userFolder instanceof FileInfo)) { |
|
| 54 | - throw new \Exception('Home does not exist'); |
|
| 55 | - } |
|
| 56 | - return new FilesHome($principalInfo, $userFolder); |
|
| 57 | - } |
|
| 33 | + /** |
|
| 34 | + * This method returns a node for a principal. |
|
| 35 | + * |
|
| 36 | + * The passed array contains principal information, and is guaranteed to |
|
| 37 | + * at least contain a uri item. Other properties may or may not be |
|
| 38 | + * supplied by the authentication backend. |
|
| 39 | + * |
|
| 40 | + * @param array $principalInfo |
|
| 41 | + * @return INode |
|
| 42 | + */ |
|
| 43 | + function getChildForPrincipal(array $principalInfo) { |
|
| 44 | + list(,$name) = \Sabre\Uri\split($principalInfo['uri']); |
|
| 45 | + $user = \OC::$server->getUserSession()->getUser(); |
|
| 46 | + if (is_null($user) || $name !== $user->getUID()) { |
|
| 47 | + // a user is only allowed to see their own home contents, so in case another collection |
|
| 48 | + // is accessed, we return a simple empty collection for now |
|
| 49 | + // in the future this could be considered to be used for accessing shared files |
|
| 50 | + return new SimpleCollection($name); |
|
| 51 | + } |
|
| 52 | + $userFolder = \OC::$server->getUserFolder(); |
|
| 53 | + if (!($userFolder instanceof FileInfo)) { |
|
| 54 | + throw new \Exception('Home does not exist'); |
|
| 55 | + } |
|
| 56 | + return new FilesHome($principalInfo, $userFolder); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - function getName() { |
|
| 60 | - return 'files'; |
|
| 61 | - } |
|
| 59 | + function getName() { |
|
| 60 | + return 'files'; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | 63 | } |
@@ -30,33 +30,33 @@ |
||
| 30 | 30 | |
| 31 | 31 | class FilesHome extends Directory { |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @var array |
|
| 35 | - */ |
|
| 36 | - private $principalInfo; |
|
| 33 | + /** |
|
| 34 | + * @var array |
|
| 35 | + */ |
|
| 36 | + private $principalInfo; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * FilesHome constructor. |
|
| 40 | - * |
|
| 41 | - * @param array $principalInfo |
|
| 42 | - * @param FileInfo $userFolder |
|
| 43 | - */ |
|
| 44 | - public function __construct($principalInfo, FileInfo $userFolder) { |
|
| 45 | - $this->principalInfo = $principalInfo; |
|
| 46 | - $view = \OC\Files\Filesystem::getView(); |
|
| 47 | - parent::__construct($view, $userFolder); |
|
| 48 | - } |
|
| 38 | + /** |
|
| 39 | + * FilesHome constructor. |
|
| 40 | + * |
|
| 41 | + * @param array $principalInfo |
|
| 42 | + * @param FileInfo $userFolder |
|
| 43 | + */ |
|
| 44 | + public function __construct($principalInfo, FileInfo $userFolder) { |
|
| 45 | + $this->principalInfo = $principalInfo; |
|
| 46 | + $view = \OC\Files\Filesystem::getView(); |
|
| 47 | + parent::__construct($view, $userFolder); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - function delete() { |
|
| 51 | - throw new Forbidden('Permission denied to delete home folder'); |
|
| 52 | - } |
|
| 50 | + function delete() { |
|
| 51 | + throw new Forbidden('Permission denied to delete home folder'); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - function getName() { |
|
| 55 | - list(,$name) = \Sabre\Uri\split($this->principalInfo['uri']); |
|
| 56 | - return $name; |
|
| 57 | - } |
|
| 54 | + function getName() { |
|
| 55 | + list(,$name) = \Sabre\Uri\split($this->principalInfo['uri']); |
|
| 56 | + return $name; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - function setName($name) { |
|
| 60 | - throw new Forbidden('Permission denied to rename this folder'); |
|
| 61 | - } |
|
| 59 | + function setName($name) { |
|
| 60 | + throw new Forbidden('Permission denied to rename this folder'); |
|
| 61 | + } |
|
| 62 | 62 | } |