Skip to content

Commit

Permalink
Add getOwner() method to FileInfo and Node API
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Petry committed Nov 2, 2015
1 parent 73d9699 commit f563648
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/private/files/fileinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
*/
private $mount;

/**
* @var string
*/
private $owner;

/**
* @param string|boolean $path
* @param Storage\Storage $storage
Expand Down Expand Up @@ -267,4 +272,13 @@ public function isMounted() {
public function getMountPoint() {
return $this->mount;
}

public function getOwner() {
if ($this->owner) {
return $this->owner;
}

$this->owner = $this->storage->getOwner($this->internalPath);
return $this->owner;
}
}
4 changes: 4 additions & 0 deletions lib/private/files/node/node.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,8 @@ public function isEncrypted() {
public function getMountPoint() {
return $this->getFileInfo()->getMountPoint();
}

public function getOwner() {
return $this->getFileInfo()->getOwner();
}
}
8 changes: 8 additions & 0 deletions lib/public/files/fileinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,12 @@ public function isMounted();
* @since 8.0.0
*/
public function getMountPoint();

/**
* Get owner
*
* @since 9.0.0
*/
public function getOwner();

}
8 changes: 8 additions & 0 deletions lib/public/files/node.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,12 @@ public function getParent();
* @since 6.0.0
*/
public function getName();

/**
* Get the file owner
*
* @since 9.0.0
* @return string
*/
public function getOwner();
}
6 changes: 6 additions & 0 deletions lib/public/files/storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,4 +462,10 @@ public function getAvailability();
* @param bool $isAvailable
*/
public function setAvailability($isAvailable);

/**
* @param $path path for which to retrieve the owner
* @since 9.0.0
*/
public function getOwner($path);
}

0 comments on commit f563648

Please sign in to comment.