@@ -52,185 +52,185 @@ |
||
| 52 | 52 | */ |
| 53 | 53 | class Share extends \OC\Share\Constants { |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Get the items of item type shared with the current user |
|
| 57 | - * @param string $itemType |
|
| 58 | - * @param int $format (optional) Format type must be defined by the backend |
|
| 59 | - * @param mixed $parameters (optional) |
|
| 60 | - * @param int $limit Number of items to return (optional) Returns all by default |
|
| 61 | - * @param bool $includeCollections (optional) |
|
| 62 | - * @return mixed Return depends on format |
|
| 63 | - * @since 5.0.0 |
|
| 64 | - */ |
|
| 65 | - public static function getItemsSharedWith($itemType, $format = self::FORMAT_NONE, |
|
| 66 | - $parameters = null, $limit = -1, $includeCollections = false) { |
|
| 67 | - |
|
| 68 | - return \OC\Share\Share::getItemsSharedWith($itemType, $format, $parameters, $limit, $includeCollections); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * Get the items of item type shared with a user |
|
| 73 | - * @param string $itemType |
|
| 74 | - * @param string $user for which user we want the shares |
|
| 75 | - * @param int $format (optional) Format type must be defined by the backend |
|
| 76 | - * @param mixed $parameters (optional) |
|
| 77 | - * @param int $limit Number of items to return (optional) Returns all by default |
|
| 78 | - * @param bool $includeCollections (optional) |
|
| 79 | - * @return mixed Return depends on format |
|
| 80 | - * @since 7.0.0 |
|
| 81 | - */ |
|
| 82 | - public static function getItemsSharedWithUser($itemType, $user, $format = self::FORMAT_NONE, |
|
| 83 | - $parameters = null, $limit = -1, $includeCollections = false) { |
|
| 84 | - |
|
| 85 | - return \OC\Share\Share::getItemsSharedWithUser($itemType, $user, $format, $parameters, $limit, $includeCollections); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Get the item of item type shared with a given user by source |
|
| 90 | - * @param string $itemType |
|
| 91 | - * @param string $itemSource |
|
| 92 | - * @param string $user User to whom the item was shared |
|
| 93 | - * @param string $owner Owner of the share |
|
| 94 | - * @return array Return list of items with file_target, permissions and expiration |
|
| 95 | - * @since 6.0.0 - parameter $owner was added in 8.0.0 |
|
| 96 | - */ |
|
| 97 | - public static function getItemSharedWithUser($itemType, $itemSource, $user, $owner = null) { |
|
| 98 | - return \OC\Share\Share::getItemSharedWithUser($itemType, $itemSource, $user, $owner); |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * Get the item of item type shared with the current user by source |
|
| 103 | - * @param string $itemType |
|
| 104 | - * @param string $itemSource |
|
| 105 | - * @param int $format (optional) Format type must be defined by the backend |
|
| 106 | - * @param mixed $parameters |
|
| 107 | - * @param bool $includeCollections |
|
| 108 | - * @return array |
|
| 109 | - * @since 5.0.0 |
|
| 110 | - */ |
|
| 111 | - public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE, |
|
| 112 | - $parameters = null, $includeCollections = false) { |
|
| 113 | - return \OC\Share\Share::getItemSharedWithBySource($itemType, $itemSource, $format, $parameters, $includeCollections); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * Based on the given token the share information will be returned - password protected shares will be verified |
|
| 118 | - * @param string $token |
|
| 119 | - * @param bool $checkPasswordProtection |
|
| 120 | - * @return array|bool false will be returned in case the token is unknown or unauthorized |
|
| 121 | - * @since 5.0.0 - parameter $checkPasswordProtection was added in 7.0.0 |
|
| 122 | - */ |
|
| 123 | - public static function getShareByToken($token, $checkPasswordProtection = true) { |
|
| 124 | - return \OC\Share\Share::getShareByToken($token, $checkPasswordProtection); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * resolves reshares down to the last real share |
|
| 129 | - * @param array $linkItem |
|
| 130 | - * @return array file owner |
|
| 131 | - * @since 6.0.0 |
|
| 132 | - */ |
|
| 133 | - public static function resolveReShare($linkItem) { |
|
| 134 | - return \OC\Share\Share::resolveReShare($linkItem); |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - |
|
| 138 | - /** |
|
| 139 | - * Get the shared items of item type owned by the current user |
|
| 140 | - * @param string $itemType |
|
| 141 | - * @param int $format (optional) Format type must be defined by the backend |
|
| 142 | - * @param mixed $parameters |
|
| 143 | - * @param int $limit Number of items to return (optional) Returns all by default |
|
| 144 | - * @param bool $includeCollections |
|
| 145 | - * @return mixed Return depends on format |
|
| 146 | - * @since 5.0.0 |
|
| 147 | - */ |
|
| 148 | - public static function getItemsShared($itemType, $format = self::FORMAT_NONE, $parameters = null, |
|
| 149 | - $limit = -1, $includeCollections = false) { |
|
| 150 | - |
|
| 151 | - return \OC\Share\Share::getItemsShared($itemType, $format, $parameters, $limit, $includeCollections); |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Get the shared item of item type owned by the current user |
|
| 156 | - * @param string $itemType |
|
| 157 | - * @param string $itemSource |
|
| 158 | - * @param int $format (optional) Format type must be defined by the backend |
|
| 159 | - * @param mixed $parameters |
|
| 160 | - * @param bool $includeCollections |
|
| 161 | - * @return mixed Return depends on format |
|
| 162 | - * @since 5.0.0 |
|
| 163 | - */ |
|
| 164 | - public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE, |
|
| 165 | - $parameters = null, $includeCollections = false) { |
|
| 166 | - |
|
| 167 | - return \OC\Share\Share::getItemShared($itemType, $itemSource, $format, $parameters, $includeCollections); |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Share an item with a user, group, or via private link |
|
| 172 | - * @param string $itemType |
|
| 173 | - * @param string $itemSource |
|
| 174 | - * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
| 175 | - * @param string $shareWith User or group the item is being shared with |
|
| 176 | - * @param int $permissions CRUDS |
|
| 177 | - * @param string $itemSourceName |
|
| 178 | - * @param \DateTime|null $expirationDate |
|
| 179 | - * @param bool|null $passwordChanged |
|
| 180 | - * @return bool|string Returns true on success or false on failure, Returns token on success for links |
|
| 181 | - * @throws \OC\HintException when the share type is remote and the shareWith is invalid |
|
| 182 | - * @throws \Exception |
|
| 183 | - * @since 5.0.0 - parameter $itemSourceName was added in 6.0.0, parameter $expirationDate was added in 7.0.0, parameter $passwordChanged added in 9.0.0 |
|
| 184 | - */ |
|
| 185 | - public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null, \DateTime $expirationDate = null, $passwordChanged = null) { |
|
| 186 | - return \OC\Share\Share::shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName, $expirationDate, $passwordChanged); |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - /** |
|
| 190 | - * Unshare an item from a user, group, or delete a private link |
|
| 191 | - * @param string $itemType |
|
| 192 | - * @param string $itemSource |
|
| 193 | - * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
| 194 | - * @param string $shareWith User or group the item is being shared with |
|
| 195 | - * @param string $owner owner of the share, if null the current user is used |
|
| 196 | - * @return boolean true on success or false on failure |
|
| 197 | - * @since 5.0.0 - parameter $owner was added in 8.0.0 |
|
| 198 | - */ |
|
| 199 | - public static function unshare($itemType, $itemSource, $shareType, $shareWith, $owner = null) { |
|
| 200 | - return \OC\Share\Share::unshare($itemType, $itemSource, $shareType, $shareWith, $owner); |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - /** |
|
| 204 | - * sent status if users got informed by mail about share |
|
| 205 | - * @param string $itemType |
|
| 206 | - * @param string $itemSource |
|
| 207 | - * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
| 208 | - * @param string $recipient with whom was the item shared |
|
| 209 | - * @param bool $status |
|
| 210 | - * @since 6.0.0 - parameter $originIsSource was added in 8.0.0 |
|
| 211 | - */ |
|
| 212 | - public static function setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status) { |
|
| 213 | - return \OC\Share\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status); |
|
| 214 | - } |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * Get the backend class for the specified item type |
|
| 218 | - * @param string $itemType |
|
| 219 | - * @return Share_Backend |
|
| 220 | - * @since 5.0.0 |
|
| 221 | - */ |
|
| 222 | - public static function getBackend($itemType) { |
|
| 223 | - return \OC\Share\Share::getBackend($itemType); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - /** |
|
| 227 | - * In case a password protected link is not yet authenticated this function will return false |
|
| 228 | - * |
|
| 229 | - * @param array $linkItem |
|
| 230 | - * @return bool |
|
| 231 | - * @since 7.0.0 |
|
| 232 | - */ |
|
| 233 | - public static function checkPasswordProtectedShare(array $linkItem) { |
|
| 234 | - return \OC\Share\Share::checkPasswordProtectedShare($linkItem); |
|
| 235 | - } |
|
| 55 | + /** |
|
| 56 | + * Get the items of item type shared with the current user |
|
| 57 | + * @param string $itemType |
|
| 58 | + * @param int $format (optional) Format type must be defined by the backend |
|
| 59 | + * @param mixed $parameters (optional) |
|
| 60 | + * @param int $limit Number of items to return (optional) Returns all by default |
|
| 61 | + * @param bool $includeCollections (optional) |
|
| 62 | + * @return mixed Return depends on format |
|
| 63 | + * @since 5.0.0 |
|
| 64 | + */ |
|
| 65 | + public static function getItemsSharedWith($itemType, $format = self::FORMAT_NONE, |
|
| 66 | + $parameters = null, $limit = -1, $includeCollections = false) { |
|
| 67 | + |
|
| 68 | + return \OC\Share\Share::getItemsSharedWith($itemType, $format, $parameters, $limit, $includeCollections); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * Get the items of item type shared with a user |
|
| 73 | + * @param string $itemType |
|
| 74 | + * @param string $user for which user we want the shares |
|
| 75 | + * @param int $format (optional) Format type must be defined by the backend |
|
| 76 | + * @param mixed $parameters (optional) |
|
| 77 | + * @param int $limit Number of items to return (optional) Returns all by default |
|
| 78 | + * @param bool $includeCollections (optional) |
|
| 79 | + * @return mixed Return depends on format |
|
| 80 | + * @since 7.0.0 |
|
| 81 | + */ |
|
| 82 | + public static function getItemsSharedWithUser($itemType, $user, $format = self::FORMAT_NONE, |
|
| 83 | + $parameters = null, $limit = -1, $includeCollections = false) { |
|
| 84 | + |
|
| 85 | + return \OC\Share\Share::getItemsSharedWithUser($itemType, $user, $format, $parameters, $limit, $includeCollections); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Get the item of item type shared with a given user by source |
|
| 90 | + * @param string $itemType |
|
| 91 | + * @param string $itemSource |
|
| 92 | + * @param string $user User to whom the item was shared |
|
| 93 | + * @param string $owner Owner of the share |
|
| 94 | + * @return array Return list of items with file_target, permissions and expiration |
|
| 95 | + * @since 6.0.0 - parameter $owner was added in 8.0.0 |
|
| 96 | + */ |
|
| 97 | + public static function getItemSharedWithUser($itemType, $itemSource, $user, $owner = null) { |
|
| 98 | + return \OC\Share\Share::getItemSharedWithUser($itemType, $itemSource, $user, $owner); |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * Get the item of item type shared with the current user by source |
|
| 103 | + * @param string $itemType |
|
| 104 | + * @param string $itemSource |
|
| 105 | + * @param int $format (optional) Format type must be defined by the backend |
|
| 106 | + * @param mixed $parameters |
|
| 107 | + * @param bool $includeCollections |
|
| 108 | + * @return array |
|
| 109 | + * @since 5.0.0 |
|
| 110 | + */ |
|
| 111 | + public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE, |
|
| 112 | + $parameters = null, $includeCollections = false) { |
|
| 113 | + return \OC\Share\Share::getItemSharedWithBySource($itemType, $itemSource, $format, $parameters, $includeCollections); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * Based on the given token the share information will be returned - password protected shares will be verified |
|
| 118 | + * @param string $token |
|
| 119 | + * @param bool $checkPasswordProtection |
|
| 120 | + * @return array|bool false will be returned in case the token is unknown or unauthorized |
|
| 121 | + * @since 5.0.0 - parameter $checkPasswordProtection was added in 7.0.0 |
|
| 122 | + */ |
|
| 123 | + public static function getShareByToken($token, $checkPasswordProtection = true) { |
|
| 124 | + return \OC\Share\Share::getShareByToken($token, $checkPasswordProtection); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * resolves reshares down to the last real share |
|
| 129 | + * @param array $linkItem |
|
| 130 | + * @return array file owner |
|
| 131 | + * @since 6.0.0 |
|
| 132 | + */ |
|
| 133 | + public static function resolveReShare($linkItem) { |
|
| 134 | + return \OC\Share\Share::resolveReShare($linkItem); |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + |
|
| 138 | + /** |
|
| 139 | + * Get the shared items of item type owned by the current user |
|
| 140 | + * @param string $itemType |
|
| 141 | + * @param int $format (optional) Format type must be defined by the backend |
|
| 142 | + * @param mixed $parameters |
|
| 143 | + * @param int $limit Number of items to return (optional) Returns all by default |
|
| 144 | + * @param bool $includeCollections |
|
| 145 | + * @return mixed Return depends on format |
|
| 146 | + * @since 5.0.0 |
|
| 147 | + */ |
|
| 148 | + public static function getItemsShared($itemType, $format = self::FORMAT_NONE, $parameters = null, |
|
| 149 | + $limit = -1, $includeCollections = false) { |
|
| 150 | + |
|
| 151 | + return \OC\Share\Share::getItemsShared($itemType, $format, $parameters, $limit, $includeCollections); |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Get the shared item of item type owned by the current user |
|
| 156 | + * @param string $itemType |
|
| 157 | + * @param string $itemSource |
|
| 158 | + * @param int $format (optional) Format type must be defined by the backend |
|
| 159 | + * @param mixed $parameters |
|
| 160 | + * @param bool $includeCollections |
|
| 161 | + * @return mixed Return depends on format |
|
| 162 | + * @since 5.0.0 |
|
| 163 | + */ |
|
| 164 | + public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE, |
|
| 165 | + $parameters = null, $includeCollections = false) { |
|
| 166 | + |
|
| 167 | + return \OC\Share\Share::getItemShared($itemType, $itemSource, $format, $parameters, $includeCollections); |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Share an item with a user, group, or via private link |
|
| 172 | + * @param string $itemType |
|
| 173 | + * @param string $itemSource |
|
| 174 | + * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
| 175 | + * @param string $shareWith User or group the item is being shared with |
|
| 176 | + * @param int $permissions CRUDS |
|
| 177 | + * @param string $itemSourceName |
|
| 178 | + * @param \DateTime|null $expirationDate |
|
| 179 | + * @param bool|null $passwordChanged |
|
| 180 | + * @return bool|string Returns true on success or false on failure, Returns token on success for links |
|
| 181 | + * @throws \OC\HintException when the share type is remote and the shareWith is invalid |
|
| 182 | + * @throws \Exception |
|
| 183 | + * @since 5.0.0 - parameter $itemSourceName was added in 6.0.0, parameter $expirationDate was added in 7.0.0, parameter $passwordChanged added in 9.0.0 |
|
| 184 | + */ |
|
| 185 | + public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null, \DateTime $expirationDate = null, $passwordChanged = null) { |
|
| 186 | + return \OC\Share\Share::shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName, $expirationDate, $passwordChanged); |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + /** |
|
| 190 | + * Unshare an item from a user, group, or delete a private link |
|
| 191 | + * @param string $itemType |
|
| 192 | + * @param string $itemSource |
|
| 193 | + * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
| 194 | + * @param string $shareWith User or group the item is being shared with |
|
| 195 | + * @param string $owner owner of the share, if null the current user is used |
|
| 196 | + * @return boolean true on success or false on failure |
|
| 197 | + * @since 5.0.0 - parameter $owner was added in 8.0.0 |
|
| 198 | + */ |
|
| 199 | + public static function unshare($itemType, $itemSource, $shareType, $shareWith, $owner = null) { |
|
| 200 | + return \OC\Share\Share::unshare($itemType, $itemSource, $shareType, $shareWith, $owner); |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + /** |
|
| 204 | + * sent status if users got informed by mail about share |
|
| 205 | + * @param string $itemType |
|
| 206 | + * @param string $itemSource |
|
| 207 | + * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
| 208 | + * @param string $recipient with whom was the item shared |
|
| 209 | + * @param bool $status |
|
| 210 | + * @since 6.0.0 - parameter $originIsSource was added in 8.0.0 |
|
| 211 | + */ |
|
| 212 | + public static function setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status) { |
|
| 213 | + return \OC\Share\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status); |
|
| 214 | + } |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * Get the backend class for the specified item type |
|
| 218 | + * @param string $itemType |
|
| 219 | + * @return Share_Backend |
|
| 220 | + * @since 5.0.0 |
|
| 221 | + */ |
|
| 222 | + public static function getBackend($itemType) { |
|
| 223 | + return \OC\Share\Share::getBackend($itemType); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + /** |
|
| 227 | + * In case a password protected link is not yet authenticated this function will return false |
|
| 228 | + * |
|
| 229 | + * @param array $linkItem |
|
| 230 | + * @return bool |
|
| 231 | + * @since 7.0.0 |
|
| 232 | + */ |
|
| 233 | + public static function checkPasswordProtectedShare(array $linkItem) { |
|
| 234 | + return \OC\Share\Share::checkPasswordProtectedShare($linkItem); |
|
| 235 | + } |
|
| 236 | 236 | } |