Completed
Push — master ( e56759...9aced2 )
by Morris
14:52
created

Share::getItemShared()   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 Bart Visscher <[email protected]>
6
 * @author Björn Schießle <[email protected]>
7
 * @author Joas Schilling <[email protected]>
8
 * @author Jörn Friedrich Dreyer <[email protected]>
9
 * @author Morris Jobke <[email protected]>
10
 * @author Robin McCorkell <[email protected]>
11
 * @author Thomas Müller <[email protected]>
12
 *
13
 * @license AGPL-3.0
14
 *
15
 * This code is free software: you can redistribute it and/or modify
16
 * it under the terms of the GNU Affero General Public License, version 3,
17
 * as published by the Free Software Foundation.
18
 *
19
 * This program is distributed in the hope that it will be useful,
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
 * GNU Affero General Public License for more details.
23
 *
24
 * You should have received a copy of the GNU Affero General Public License, version 3,
25
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
26
 *
27
 */
28
29
/**
30
 * Public interface of ownCloud for apps to use.
31
 * Share Class
32
 *
33
 */
34
35
// use OCP namespace for all classes that are considered public.
36
// This means that they should be used by apps instead of the internal ownCloud classes
37
namespace OCP;
38
39
/**
40
 * This class provides the ability for apps to share their content between users.
41
 * Apps must create a backend class that implements OCP\Share_Backend and register it with this class.
42
 *
43
 * It provides the following hooks:
44
 *  - post_shared
45
 * @since 5.0.0
46
 */
47
class Share extends \OC\Share\Constants {
48
49
	/**
50
	 * Get the item of item type shared with a given user by source
51
	 * @param string $itemType
52
	 * @param string $itemSource
53
	 * @param string $user User to whom the item was shared
54
	 * @param string $owner Owner of the share
55
	 * @return array Return list of items with file_target, permissions and expiration
56
	 * @since 6.0.0 - parameter $owner was added in 8.0.0
57
	 */
58
	public static function getItemSharedWithUser($itemType, $itemSource, $user, $owner = null) {
59
		return \OC\Share\Share::getItemSharedWithUser($itemType, $itemSource, $user, $owner);
60
	}
61
62
	/**
63
	 * Get the item of item type shared with the current user by source
64
	 * @param string $itemType
65
	 * @param string $itemSource
66
	 * @param int $format (optional) Format type must be defined by the backend
67
	 * @param mixed $parameters
68
	 * @param bool $includeCollections
69
	 * @return array
70
	 * @since 5.0.0
71
	 */
72
	public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE,
73
		$parameters = null, $includeCollections = false) {
74
		return \OC\Share\Share::getItemSharedWithBySource($itemType, $itemSource, $format, $parameters, $includeCollections);
75
	}
76
77
	/**
78
	 * Based on the given token the share information will be returned - password protected shares will be verified
79
	 * @param string $token
80
	 * @param bool $checkPasswordProtection
81
	 * @return array|bool false will be returned in case the token is unknown or unauthorized
82
	 * @since 5.0.0 - parameter $checkPasswordProtection was added in 7.0.0
83
	 */
84
	public static function getShareByToken($token, $checkPasswordProtection = true) {
85
		return \OC\Share\Share::getShareByToken($token, $checkPasswordProtection);
86
	}
87
88
89
	/**
90
	 * Get the shared items of item type owned by the current user
91
	 * @param string $itemType
92
	 * @param int $format (optional) Format type must be defined by the backend
93
	 * @param mixed $parameters
94
	 * @param int $limit Number of items to return (optional) Returns all by default
95
	 * @param bool $includeCollections
96
	 * @return mixed Return depends on format
97
	 * @since 5.0.0
98
	 */
99
	public static function getItemsShared($itemType, $format = self::FORMAT_NONE, $parameters = null,
100
		$limit = -1, $includeCollections = false) {
101
102
		return \OC\Share\Share::getItemsShared($itemType, $format, $parameters, $limit, $includeCollections);
103
	}
104
105
	/**
106
	 * Get the shared item of item type owned by the current user
107
	 * @param string $itemType
108
	 * @param string $itemSource
109
	 * @param int $format (optional) Format type must be defined by the backend
110
	 * @param mixed $parameters
111
	 * @param bool $includeCollections
112
	 * @return mixed Return depends on format
113
	 * @since 5.0.0
114
	 */
115
	public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE,
116
	                                     $parameters = null, $includeCollections = false) {
117
118
		return \OC\Share\Share::getItemShared($itemType, $itemSource, $format, $parameters, $includeCollections);
119
	}
120
121
	/**
122
	 * sent status if users got informed by mail about share
123
	 * @param string $itemType
124
	 * @param string $itemSource
125
	 * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
126
	 * @param string $recipient with whom was the item shared
127
	 * @param bool $status
128
	 * @since 6.0.0 - parameter $originIsSource was added in 8.0.0
129
	 */
130
	public static function setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status) {
131
		return \OC\Share\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status);
132
	}
133
}
134