server/lib/private/share20/share.php

304 lines
4.8 KiB
PHP
Raw Normal View History

<?php
/**
* @author Roeland Jago Douma <rullzer@owncloud.com>
*
2016-01-12 14:02:16 +00:00
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @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 {
/** @var string */
private $id;
/** @var string */
private $providerId;
/** @var Node */
private $path;
/** @var int */
private $shareType;
/** @var IUser|IGroup */
private $sharedWith;
/** @var IUser */
private $sharedBy;
/** @var IUser */
private $shareOwner;
/** @var int */
private $permissions;
/** @var \DateTime */
private $expireDate;
/** @var string */
private $password;
/** @var string */
private $token;
/** @var int */
private $parent;
2015-11-02 20:06:55 +00:00
/** @var string */
private $target;
/** @var \DateTime */
private $shareTime;
/** @var bool */
private $mailSend;
2015-11-02 20:06:55 +00:00
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function setId($id) {
$this->id = $id;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function getId() {
return $this->id;
}
/**
* @inheritdoc
*/
public function getFullId() {
return $this->providerId . ':' . $this->id;
}
/**
* @inheritdoc
*/
public function setProviderId($id) {
$this->providerId = $id;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function setNode(Node $path) {
$this->path = $path;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function getNode() {
return $this->path;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function setShareType($shareType) {
$this->shareType = $shareType;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function getShareType() {
return $this->shareType;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function setSharedWith($sharedWith) {
if (!is_string($sharedWith)) {
throw new \InvalidArgumentException();
}
$this->sharedWith = $sharedWith;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function getSharedWith() {
return $this->sharedWith;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function setPermissions($permissions) {
//TODO checkes
$this->permissions = $permissions;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function getPermissions() {
return $this->permissions;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function setExpirationDate($expireDate) {
//TODO checks
$this->expireDate = $expireDate;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function getExpirationDate() {
return $this->expireDate;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function setSharedBy($sharedBy) {
if (!is_string($sharedBy)) {
throw new \InvalidArgumentException();
}
//TODO checks
$this->sharedBy = $sharedBy;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function getSharedBy() {
//TODO check if set
return $this->sharedBy;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function setShareOwner($shareOwner) {
if (!is_string($shareOwner)) {
throw new \InvalidArgumentException();
}
//TODO checks
$this->shareOwner = $shareOwner;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function getShareOwner() {
//TODO check if set
return $this->shareOwner;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function setPassword($password) {
$this->password = $password;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function getPassword() {
return $this->password;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function setToken($token) {
$this->token = $token;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function getToken() {
return $this->token;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function setParent($parent) {
$this->parent = $parent;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
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;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function setShareTime(\DateTime $shareTime) {
$this->shareTime = $shareTime;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
2016-01-27 10:50:49 +00:00
public function getShareTime() {
return $this->shareTime;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function setMailSend($mailSend) {
$this->mailSend = $mailSend;
return $this;
}
/**
2016-01-27 10:50:49 +00:00
* @inheritdoc
*/
public function getMailSend() {
return $this->mailSend;
}
}