123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640 |
- <?php
- /**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- * @author Daniel Calviño Sánchez <danxuliu@gmail.com>
- * @author Joas Schilling <coding@schilljs.com>
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Maxence Lange <maxence@nextcloud.com>
- * @author Robin Appelman <robin@icewind.nl>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @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 OCP\Share;
- use OCP\Files\Cache\ICacheEntry;
- use OCP\Files\File;
- use OCP\Files\Folder;
- use OCP\Files\Node;
- use OCP\Files\NotFoundException;
- use OCP\Share\Exceptions\IllegalIDChangeException;
- /**
- * This interface allows to represent a share object.
- *
- * This interface must not be implemented in your application.
- *
- * @since 9.0.0
- */
- interface IShare {
- /**
- * @since 17.0.0
- */
- public const TYPE_USER = 0;
- /**
- * @since 17.0.0
- */
- public const TYPE_GROUP = 1;
- /**
- * @internal
- * @since 18.0.0
- */
- public const TYPE_USERGROUP = 2;
- /**
- * @since 17.0.0
- */
- public const TYPE_LINK = 3;
- /**
- * @since 17.0.0
- */
- public const TYPE_EMAIL = 4;
- /**
- * ToDo Check if it is still in use otherwise remove it
- * @since 17.0.0
- */
- // public const TYPE_CONTACT = 5;
- /**
- * @since 17.0.0
- */
- public const TYPE_REMOTE = 6;
- /**
- * @since 17.0.0
- */
- public const TYPE_CIRCLE = 7;
- /**
- * @since 17.0.0
- */
- public const TYPE_GUEST = 8;
- /**
- * @since 17.0.0
- */
- public const TYPE_REMOTE_GROUP = 9;
- /**
- * @since 17.0.0
- */
- public const TYPE_ROOM = 10;
- /**
- * Internal type used by RoomShareProvider
- * @since 17.0.0
- */
- // const TYPE_USERROOM = 11;
- /**
- * @since 21.0.0
- */
- public const TYPE_DECK = 12;
- /**
- * @internal
- * @since 21.0.0
- */
- public const TYPE_DECK_USER = 13;
- /**
- * @since 26.0.0
- */
- public const TYPE_SCIENCEMESH = 15;
- /**
- * @since 18.0.0
- */
- public const STATUS_PENDING = 0;
- /**
- * @since 18.0.0
- */
- public const STATUS_ACCEPTED = 1;
- /**
- * @since 18.0.0
- */
- public const STATUS_REJECTED = 2;
- /**
- * Set the internal id of the share
- * It is only allowed to set the internal id of a share once.
- * Attempts to override the internal id will result in an IllegalIDChangeException
- *
- * @param string $id
- * @return \OCP\Share\IShare
- * @throws IllegalIDChangeException
- * @throws \InvalidArgumentException
- * @since 9.1.0
- */
- public function setId($id);
- /**
- * Get the internal id of the share.
- *
- * @return string
- * @since 9.0.0
- */
- public function getId();
- /**
- * Get the full share id. This is the <providerid>:<internalid>.
- * The full id is unique in the system.
- *
- * @return string
- * @since 9.0.0
- * @throws \UnexpectedValueException If the fullId could not be constructed
- */
- public function getFullId();
- /**
- * Set the provider id of the share
- * It is only allowed to set the provider id of a share once.
- * Attempts to override the provider id will result in an IllegalIDChangeException
- *
- * @param string $id
- * @return \OCP\Share\IShare
- * @throws IllegalIDChangeException
- * @throws \InvalidArgumentException
- * @since 9.1.0
- */
- public function setProviderId($id);
- /**
- * Set the node of the file/folder that is shared
- *
- * @param Node $node
- * @return \OCP\Share\IShare The modified object
- * @since 9.0.0
- */
- public function setNode(Node $node);
- /**
- * Get the node of the file/folder that is shared
- *
- * @return File|Folder
- * @since 9.0.0
- * @throws NotFoundException
- */
- public function getNode();
- /**
- * Set file id for lazy evaluation of the node
- * @param int $fileId
- * @return \OCP\Share\IShare The modified object
- * @since 9.0.0
- */
- public function setNodeId($fileId);
- /**
- * Get the fileid of the node of this share
- * @return int
- * @since 9.0.0
- * @throws NotFoundException
- */
- public function getNodeId();
- /**
- * Set the type of node (file/folder)
- *
- * @param string $type
- * @return \OCP\Share\IShare The modified object
- * @since 9.0.0
- */
- public function setNodeType($type);
- /**
- * Get the type of node (file/folder)
- *
- * @return string
- * @since 9.0.0
- * @throws NotFoundException
- */
- public function getNodeType();
- /**
- * Set the shareType
- *
- * @param int $shareType
- * @return \OCP\Share\IShare The modified object
- * @since 9.0.0
- */
- public function setShareType($shareType);
- /**
- * Get the shareType
- *
- * @return int
- * @since 9.0.0
- */
- public function getShareType();
- /**
- * Set the receiver of this share.
- *
- * @param string $sharedWith
- * @return \OCP\Share\IShare The modified object
- * @since 9.0.0
- */
- public function setSharedWith($sharedWith);
- /**
- * Get the receiver of this share.
- *
- * @return string
- * @since 9.0.0
- */
- public function getSharedWith();
- /**
- * Set the display name of the receiver of this share.
- *
- * @param string $displayName
- * @return \OCP\Share\IShare The modified object
- * @since 14.0.0
- */
- public function setSharedWithDisplayName($displayName);
- /**
- * Get the display name of the receiver of this share.
- *
- * @return string
- * @since 14.0.0
- */
- public function getSharedWithDisplayName();
- /**
- * Set the avatar of the receiver of this share.
- *
- * @param string $src
- * @return \OCP\Share\IShare The modified object
- * @since 14.0.0
- */
- public function setSharedWithAvatar($src);
- /**
- * Get the avatar of the receiver of this share.
- *
- * @return string
- * @since 14.0.0
- */
- public function getSharedWithAvatar();
- /**
- * Set the permissions.
- * See \OCP\Constants::PERMISSION_*
- *
- * @param int $permissions
- * @return IShare The modified object
- * @since 9.0.0
- */
- public function setPermissions($permissions);
- /**
- * Get the share permissions
- * See \OCP\Constants::PERMISSION_*
- *
- * @return int
- * @since 9.0.0
- */
- public function getPermissions();
- /**
- * Create share attributes object
- *
- * @since 25.0.0
- * @return IAttributes
- */
- public function newAttributes(): IAttributes;
- /**
- * Set share attributes
- *
- * @param ?IAttributes $attributes
- * @since 25.0.0
- * @return IShare The modified object
- */
- public function setAttributes(?IAttributes $attributes);
- /**
- * Get share attributes
- *
- * @since 25.0.0
- * @return ?IAttributes
- */
- public function getAttributes(): ?IAttributes;
- /**
- * Set the accepted status
- * See self::STATUS_*
- *
- * @param int $status
- * @return IShare The modified object
- * @since 18.0.0
- */
- public function setStatus(int $status): IShare;
- /**
- * Get the accepted status
- * See self::STATUS_*
- *
- * @return int
- * @since 18.0.0
- */
- public function getStatus(): int;
- /**
- * Attach a note to a share
- *
- * @param string $note
- * @return \OCP\Share\IShare The modified object
- * @since 14.0.0
- */
- public function setNote($note);
- /**
- * Get note attached to a share
- *
- * @return string
- * @since 14.0.0
- */
- public function getNote();
- /**
- * Set the expiration date
- *
- * @param \DateTime|null $expireDate
- * @return \OCP\Share\IShare The modified object
- * @since 9.0.0
- */
- public function setExpirationDate(\DateTime|null $expireDate);
- /**
- * Get the expiration date
- *
- * @return \DateTime|null
- * @since 9.0.0
- */
- public function getExpirationDate();
- /**
- * Set overwrite flag for falsy expiry date vavlues
- *
- * @param bool $noExpirationDate
- * @return \OCP\Share\IShare The modified object
- * @since 28.0.7
- */
- public function setNoExpirationDate(bool $noExpirationDate);
- /**
- * Get value of overwrite falsy expiry date flag
- *
- * @return bool
- * @since 28.0.7
- */
- public function getNoExpirationDate();
- /**
- * Is the share expired ?
- *
- * @return boolean
- * @since 18.0.0
- */
- public function isExpired();
- /**
- * set a label for a share, some shares, e.g. public links can have a label
- *
- * @param string $label
- * @return \OCP\Share\IShare The modified object
- * @since 15.0.0
- */
- public function setLabel($label);
- /**
- * get label for the share, some shares, e.g. public links can have a label
- *
- * @return string
- * @since 15.0.0
- */
- public function getLabel();
- /**
- * Set the sharer of the path.
- *
- * @param string $sharedBy
- * @return \OCP\Share\IShare The modified object
- * @since 9.0.0
- */
- public function setSharedBy($sharedBy);
- /**
- * Get share sharer
- *
- * @return string
- * @since 9.0.0
- */
- public function getSharedBy();
- /**
- * Set the original share owner (who owns the path that is shared)
- *
- * @param string $shareOwner
- * @return \OCP\Share\IShare The modified object
- * @since 9.0.0
- */
- public function setShareOwner($shareOwner);
- /**
- * Get the original share owner (who owns the path that is shared)
- *
- * @return string
- * @since 9.0.0
- */
- public function getShareOwner();
- /**
- * Set the password for this share.
- * When the share is passed to the share manager to be created
- * or updated the password will be hashed.
- *
- * @param string|null $password
- * @return \OCP\Share\IShare The modified object
- * @since 9.0.0
- */
- public function setPassword($password);
- /**
- * Get the password of this share.
- * If this share is obtained via a shareprovider the password is
- * hashed.
- *
- * @return string
- * @since 9.0.0
- */
- public function getPassword();
- /**
- * Set the password's expiration time of this share.
- *
- * @return self The modified object
- * @since 24.0.0
- */
- public function setPasswordExpirationTime(?\DateTimeInterface $passwordExpirationTime = null): IShare;
- /**
- * Get the password's expiration time of this share.
- * @since 24.0.0
- */
- public function getPasswordExpirationTime(): ?\DateTimeInterface;
- /**
- * Set if the recipient can start a conversation with the owner to get the
- * password using Nextcloud Talk.
- *
- * @param bool $sendPasswordByTalk
- * @return \OCP\Share\IShare The modified object
- * @since 14.0.0
- */
- public function setSendPasswordByTalk(bool $sendPasswordByTalk);
- /**
- * Get if the recipient can start a conversation with the owner to get the
- * password using Nextcloud Talk.
- * The returned value does not take into account other factors, like Talk
- * being enabled for the owner of the share or not; it just cover whether
- * the option is enabled for the share itself or not.
- *
- * @return bool
- * @since 14.0.0
- */
- public function getSendPasswordByTalk(): bool;
- /**
- * Set the public link token.
- *
- * @param string $token
- * @return \OCP\Share\IShare The modified object
- * @since 9.0.0
- */
- public function setToken($token);
- /**
- * Get the public link token.
- *
- * @return string
- * @since 9.0.0
- */
- public function getToken();
- /**
- * Set the target path of this share relative to the recipients user folder.
- *
- * @param string $target
- * @return \OCP\Share\IShare The modified object
- * @since 9.0.0
- */
- public function setTarget($target);
- /**
- * Get the target path of this share relative to the recipients user folder.
- *
- * @return string
- * @since 9.0.0
- */
- public function getTarget();
- /**
- * Set the time this share was created
- *
- * @param \DateTime $shareTime
- * @return \OCP\Share\IShare The modified object
- * @since 9.0.0
- */
- public function setShareTime(\DateTime $shareTime);
- /**
- * Get the timestamp this share was created
- *
- * @return \DateTime
- * @since 9.0.0
- */
- public function getShareTime();
- /**
- * Set if the recipient is informed by mail about the share.
- *
- * @param bool $mailSend
- * @return \OCP\Share\IShare The modified object
- * @since 9.0.0
- */
- public function setMailSend($mailSend);
- /**
- * Get if the recipient informed by mail about the share.
- *
- * @return bool
- * @since 9.0.0
- */
- public function getMailSend();
- /**
- * Set the cache entry for the shared node
- *
- * @param ICacheEntry $entry
- * @since 11.0.0
- */
- public function setNodeCacheEntry(ICacheEntry $entry);
- /**
- * Get the cache entry for the shared node
- *
- * @return null|ICacheEntry
- * @since 11.0.0
- */
- public function getNodeCacheEntry();
- /**
- * Sets a shares hide download state
- * This is mainly for public shares. It will signal that the share page should
- * hide download buttons etc.
- *
- * @param bool $hide
- * @return IShare
- * @since 15.0.0
- */
- public function setHideDownload(bool $hide): IShare;
- /**
- * Gets a shares hide download state
- * This is mainly for public shares. It will signal that the share page should
- * hide download buttons etc.
- *
- * @return bool
- * @since 15.0.0
- */
- public function getHideDownload(): bool;
- }
|