Completed
Push — master ( c5f14a...cf7c4a )
by Morris
50:52 queued 34:25
created

Share::setSendMailStatus()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 5
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (c) 2016, ownCloud, Inc.
4
 *
5
 * @author Andreas Fischer <[email protected]>
6
 * @author Bart Visscher <[email protected]>
7
 * @author Björn Schießle <[email protected]>
8
 * @author Joas Schilling <[email protected]>
9
 * @author Jörn Friedrich Dreyer <[email protected]>
10
 * @author Michael Gapczynski <[email protected]>
11
 * @author Michael Kuhn <[email protected]>
12
 * @author Morris Jobke <[email protected]>
13
 * @author Robin McCorkell <[email protected]>
14
 * @author Roeland Jago Douma <[email protected]>
15
 * @author Sam Tuke <[email protected]>
16
 * @author Stefan Weil <[email protected]>
17
 * @author Thomas Müller <[email protected]>
18
 *
19
 * @license AGPL-3.0
20
 *
21
 * This code is free software: you can redistribute it and/or modify
22
 * it under the terms of the GNU Affero General Public License, version 3,
23
 * as published by the Free Software Foundation.
24
 *
25
 * This program is distributed in the hope that it will be useful,
26
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
 * GNU Affero General Public License for more details.
29
 *
30
 * You should have received a copy of the GNU Affero General Public License, version 3,
31
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
32
 *
33
 */
34
35
/**
36
 * Public interface of ownCloud for apps to use.
37
 * Share Class
38
 *
39
 */
40
41
// use OCP namespace for all classes that are considered public.
42
// This means that they should be used by apps instead of the internal ownCloud classes
43
namespace OCP;
44
45
/**
46
 * This class provides the ability for apps to share their content between users.
47
 * Apps must create a backend class that implements OCP\Share_Backend and register it with this class.
48
 *
49
 * It provides the following hooks:
50
 *  - post_shared
51
 * @since 5.0.0
52
 */
53
class Share extends \OC\Share\Constants {
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
	 * Unshare an item from a user, group, or delete a 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 string $owner owner of the share, if null the current user is used
177
	 * @return boolean true on success or false on failure
178
	 * @since 5.0.0 - parameter $owner was added in 8.0.0
179
	 */
180
	public static function unshare($itemType, $itemSource, $shareType, $shareWith, $owner = null) {
181
		return \OC\Share\Share::unshare($itemType, $itemSource, $shareType, $shareWith, $owner);
182
	}
183
184
	/**
185
	 * sent status if users got informed by mail about share
186
	 * @param string $itemType
187
	 * @param string $itemSource
188
	 * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
189
	 * @param string $recipient with whom was the item shared
190
	 * @param bool $status
191
	 * @since 6.0.0 - parameter $originIsSource was added in 8.0.0
192
	 */
193
	public static function setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status) {
194
		return \OC\Share\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status);
195
	}
196
197
	/**
198
	 * Get the backend class for the specified item type
199
	 * @param string $itemType
200
	 * @return Share_Backend
201
	 * @since 5.0.0
202
	 */
203
	public static function getBackend($itemType) {
204
		return \OC\Share\Share::getBackend($itemType);
205
	}
206
}
207