Completed
Push — master ( d7406e...4c558c )
by Morris
15:08
created

Share::getItemsShared()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 5
dl 0
loc 5
rs 9.4285
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 item of item type shared with a given user by source
57
	 * @param string $itemType
58
	 * @param string $itemSource
59
	 * @param string $user User to whom the item was shared
60
	 * @param string $owner Owner of the share
61
	 * @return array Return list of items with file_target, permissions and expiration
62
	 * @since 6.0.0 - parameter $owner was added in 8.0.0
63
	 */
64
	public static function getItemSharedWithUser($itemType, $itemSource, $user, $owner = null) {
65
		return \OC\Share\Share::getItemSharedWithUser($itemType, $itemSource, $user, $owner);
66
	}
67
68
	/**
69
	 * Get the item of item type shared with the current user by source
70
	 * @param string $itemType
71
	 * @param string $itemSource
72
	 * @param int $format (optional) Format type must be defined by the backend
73
	 * @param mixed $parameters
74
	 * @param bool $includeCollections
75
	 * @return array
76
	 * @since 5.0.0
77
	 */
78
	public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE,
79
		$parameters = null, $includeCollections = false) {
80
		return \OC\Share\Share::getItemSharedWithBySource($itemType, $itemSource, $format, $parameters, $includeCollections);
81
	}
82
83
	/**
84
	 * Based on the given token the share information will be returned - password protected shares will be verified
85
	 * @param string $token
86
	 * @param bool $checkPasswordProtection
87
	 * @return array|bool false will be returned in case the token is unknown or unauthorized
88
	 * @since 5.0.0 - parameter $checkPasswordProtection was added in 7.0.0
89
	 */
90
	public static function getShareByToken($token, $checkPasswordProtection = true) {
91
		return \OC\Share\Share::getShareByToken($token, $checkPasswordProtection);
92
	}
93
94
	/**
95
	 * resolves reshares down to the last real share
96
	 * @param array $linkItem
97
	 * @return array file owner
98
	 * @since 6.0.0
99
	 */
100
	public static function resolveReShare($linkItem) {
101
		return \OC\Share\Share::resolveReShare($linkItem);
102
	}
103
104
105
	/**
106
	 * Get the shared items of item type owned by the current user
107
	 * @param string $itemType
108
	 * @param int $format (optional) Format type must be defined by the backend
109
	 * @param mixed $parameters
110
	 * @param int $limit Number of items to return (optional) Returns all by default
111
	 * @param bool $includeCollections
112
	 * @return mixed Return depends on format
113
	 * @since 5.0.0
114
	 */
115
	public static function getItemsShared($itemType, $format = self::FORMAT_NONE, $parameters = null,
116
		$limit = -1, $includeCollections = false) {
117
118
		return \OC\Share\Share::getItemsShared($itemType, $format, $parameters, $limit, $includeCollections);
119
	}
120
121
	/**
122
	 * Get the shared item of item type owned by the current user
123
	 * @param string $itemType
124
	 * @param string $itemSource
125
	 * @param int $format (optional) Format type must be defined by the backend
126
	 * @param mixed $parameters
127
	 * @param bool $includeCollections
128
	 * @return mixed Return depends on format
129
	 * @since 5.0.0
130
	 */
131
	public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE,
132
	                                     $parameters = null, $includeCollections = false) {
133
134
		return \OC\Share\Share::getItemShared($itemType, $itemSource, $format, $parameters, $includeCollections);
135
	}
136
137
	/**
138
	 * sent status if users got informed by mail about share
139
	 * @param string $itemType
140
	 * @param string $itemSource
141
	 * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
142
	 * @param string $recipient with whom was the item shared
143
	 * @param bool $status
144
	 * @since 6.0.0 - parameter $originIsSource was added in 8.0.0
145
	 */
146
	public static function setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status) {
147
		return \OC\Share\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status);
148
	}
149
}
150