2015-10-30 12:09:07 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @author Roeland Jago Douma <rullzer@owncloud.com>
|
|
|
|
*
|
2016-01-12 14:02:16 +00:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
2015-10-30 12:09:07 +00:00
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
namespace OC\Share20;
|
|
|
|
|
|
|
|
use OCP\Files\Node;
|
|
|
|
use OCP\IUser;
|
|
|
|
use OCP\IGroup;
|
|
|
|
|
2016-01-27 11:13:53 +00:00
|
|
|
class Share implements \OCP\Share\IShare {
|
2015-10-30 12:09:07 +00:00
|
|
|
|
|
|
|
/** @var string */
|
2015-10-30 12:10:08 +00:00
|
|
|
private $id;
|
2016-01-13 12:02:23 +00:00
|
|
|
/** @var string */
|
|
|
|
private $providerId;
|
2015-10-30 12:09:07 +00:00
|
|
|
/** @var Node */
|
|
|
|
private $path;
|
|
|
|
/** @var int */
|
|
|
|
private $shareType;
|
2016-01-27 19:51:26 +00:00
|
|
|
/** @var IUser|IGroup */
|
2015-10-30 12:10:08 +00:00
|
|
|
private $sharedWith;
|
2016-01-27 19:51:26 +00:00
|
|
|
/** @var IUser */
|
2015-10-30 12:09:07 +00:00
|
|
|
private $sharedBy;
|
2016-01-27 19:51:26 +00:00
|
|
|
/** @var IUser */
|
2015-10-30 12:09:07 +00:00
|
|
|
private $shareOwner;
|
|
|
|
/** @var int */
|
|
|
|
private $permissions;
|
|
|
|
/** @var \DateTime */
|
|
|
|
private $expireDate;
|
|
|
|
/** @var string */
|
|
|
|
private $password;
|
2015-10-30 12:10:08 +00:00
|
|
|
/** @var string */
|
|
|
|
private $token;
|
|
|
|
/** @var int */
|
|
|
|
private $parent;
|
2015-11-02 20:06:55 +00:00
|
|
|
/** @var string */
|
|
|
|
private $target;
|
2016-01-27 19:51:26 +00:00
|
|
|
/** @var \DateTime */
|
2015-11-06 11:05:19 +00:00
|
|
|
private $shareTime;
|
|
|
|
/** @var bool */
|
|
|
|
private $mailSend;
|
2015-11-02 20:06:55 +00:00
|
|
|
|
2015-10-30 12:09:07 +00:00
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
2015-10-30 12:10:08 +00:00
|
|
|
public function setId($id) {
|
|
|
|
$this->id = $id;
|
2015-10-30 12:09:07 +00:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
|
|
|
public function getId() {
|
2015-10-30 12:10:08 +00:00
|
|
|
return $this->id;
|
2015-10-30 12:09:07 +00:00
|
|
|
}
|
|
|
|
|
2016-01-13 12:02:23 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
public function getFullId() {
|
|
|
|
return $this->providerId . ':' . $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
public function setProviderId($id) {
|
|
|
|
$this->providerId = $id;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2015-10-30 12:09:07 +00:00
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
2016-01-27 19:51:26 +00:00
|
|
|
public function setNode(Node $path) {
|
2015-10-30 12:09:07 +00:00
|
|
|
$this->path = $path;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
2016-01-27 19:51:26 +00:00
|
|
|
public function getNode() {
|
2015-10-30 12:09:07 +00:00
|
|
|
return $this->path;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
|
|
|
public function setShareType($shareType) {
|
|
|
|
$this->shareType = $shareType;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
|
|
|
public function getShareType() {
|
|
|
|
return $this->shareType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
2015-10-30 12:10:08 +00:00
|
|
|
public function setSharedWith($sharedWith) {
|
2016-02-02 15:55:41 +00:00
|
|
|
if (!is_string($sharedWith)) {
|
|
|
|
throw new \InvalidArgumentException();
|
|
|
|
}
|
2015-10-30 12:10:08 +00:00
|
|
|
$this->sharedWith = $sharedWith;
|
2015-10-30 12:09:07 +00:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
2015-10-30 12:10:08 +00:00
|
|
|
public function getSharedWith() {
|
|
|
|
return $this->sharedWith;
|
2015-10-30 12:09:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
|
|
|
public function setPermissions($permissions) {
|
|
|
|
//TODO checkes
|
|
|
|
|
|
|
|
$this->permissions = $permissions;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
|
|
|
public function getPermissions() {
|
|
|
|
return $this->permissions;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
2015-12-15 08:52:04 +00:00
|
|
|
public function setExpirationDate($expireDate) {
|
2015-10-30 12:09:07 +00:00
|
|
|
//TODO checks
|
|
|
|
|
|
|
|
$this->expireDate = $expireDate;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
|
|
|
public function getExpirationDate() {
|
|
|
|
return $this->expireDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
|
|
|
public function setSharedBy($sharedBy) {
|
2016-02-02 15:55:41 +00:00
|
|
|
if (!is_string($sharedBy)) {
|
|
|
|
throw new \InvalidArgumentException();
|
|
|
|
}
|
2015-10-30 12:09:07 +00:00
|
|
|
//TODO checks
|
|
|
|
$this->sharedBy = $sharedBy;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
|
|
|
public function getSharedBy() {
|
|
|
|
//TODO check if set
|
|
|
|
return $this->sharedBy;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
|
|
|
public function setShareOwner($shareOwner) {
|
2016-02-02 15:55:41 +00:00
|
|
|
if (!is_string($shareOwner)) {
|
|
|
|
throw new \InvalidArgumentException();
|
|
|
|
}
|
2015-10-30 12:09:07 +00:00
|
|
|
//TODO checks
|
|
|
|
|
|
|
|
$this->shareOwner = $shareOwner;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
|
|
|
public function getShareOwner() {
|
|
|
|
//TODO check if set
|
|
|
|
return $this->shareOwner;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
|
|
|
public function setPassword($password) {
|
|
|
|
$this->password = $password;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:09:07 +00:00
|
|
|
*/
|
2015-11-06 11:05:19 +00:00
|
|
|
public function getPassword() {
|
2015-10-30 12:09:07 +00:00
|
|
|
return $this->password;
|
|
|
|
}
|
2015-10-30 12:10:08 +00:00
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:10:08 +00:00
|
|
|
*/
|
|
|
|
public function setToken($token) {
|
|
|
|
$this->token = $token;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:10:08 +00:00
|
|
|
*/
|
|
|
|
public function getToken() {
|
|
|
|
return $this->token;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:10:08 +00:00
|
|
|
*/
|
|
|
|
public function setParent($parent) {
|
|
|
|
$this->parent = $parent;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-10-30 12:10:08 +00:00
|
|
|
*/
|
|
|
|
public function getParent() {
|
|
|
|
return $this->parent;
|
|
|
|
}
|
2015-11-02 20:06:55 +00:00
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-11-02 20:06:55 +00:00
|
|
|
*/
|
|
|
|
public function setTarget($target) {
|
|
|
|
$this->target = $target;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-11-02 20:06:55 +00:00
|
|
|
*/
|
|
|
|
public function getTarget() {
|
|
|
|
return $this->target;
|
|
|
|
}
|
2015-11-06 11:05:19 +00:00
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-11-06 11:05:19 +00:00
|
|
|
*/
|
2016-01-27 19:51:26 +00:00
|
|
|
public function setShareTime(\DateTime $shareTime) {
|
2015-11-06 11:05:19 +00:00
|
|
|
$this->shareTime = $shareTime;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-11-06 11:05:19 +00:00
|
|
|
*/
|
2016-01-27 10:50:49 +00:00
|
|
|
public function getShareTime() {
|
2015-11-06 11:05:19 +00:00
|
|
|
return $this->shareTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-11-06 11:05:19 +00:00
|
|
|
*/
|
|
|
|
public function setMailSend($mailSend) {
|
|
|
|
$this->mailSend = $mailSend;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-27 10:50:49 +00:00
|
|
|
* @inheritdoc
|
2015-11-06 11:05:19 +00:00
|
|
|
*/
|
|
|
|
public function getMailSend() {
|
|
|
|
return $this->mailSend;
|
|
|
|
}
|
2015-10-30 12:09:07 +00:00
|
|
|
}
|