@@ -40,158 +40,158 @@ |
||
40 | 40 | * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
41 | 41 | */ |
42 | 42 | class JSON { |
43 | - /** |
|
44 | - * Encode and print $data in JSON format |
|
45 | - * @param array $data The data to use |
|
46 | - * @param bool $setContentType the optional content type |
|
47 | - * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
48 | - */ |
|
49 | - public static function encodedPrint( $data, $setContentType=true ) { |
|
50 | - \OC_JSON::encodedPrint($data, $setContentType); |
|
51 | - } |
|
43 | + /** |
|
44 | + * Encode and print $data in JSON format |
|
45 | + * @param array $data The data to use |
|
46 | + * @param bool $setContentType the optional content type |
|
47 | + * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
48 | + */ |
|
49 | + public static function encodedPrint( $data, $setContentType=true ) { |
|
50 | + \OC_JSON::encodedPrint($data, $setContentType); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Check if the user is logged in, send json error msg if not. |
|
55 | - * |
|
56 | - * This method checks if a user is logged in. If not, a json error |
|
57 | - * response will be return and the method will exit from execution |
|
58 | - * of the script. |
|
59 | - * The returned json will be in the format: |
|
60 | - * |
|
61 | - * {"status":"error","data":{"message":"Authentication error."}} |
|
62 | - * |
|
63 | - * Add this call to the start of all ajax method files that requires |
|
64 | - * an authenticated user. |
|
65 | - * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead |
|
66 | - */ |
|
67 | - public static function checkLoggedIn() { |
|
68 | - \OC_JSON::checkLoggedIn(); |
|
69 | - } |
|
53 | + /** |
|
54 | + * Check if the user is logged in, send json error msg if not. |
|
55 | + * |
|
56 | + * This method checks if a user is logged in. If not, a json error |
|
57 | + * response will be return and the method will exit from execution |
|
58 | + * of the script. |
|
59 | + * The returned json will be in the format: |
|
60 | + * |
|
61 | + * {"status":"error","data":{"message":"Authentication error."}} |
|
62 | + * |
|
63 | + * Add this call to the start of all ajax method files that requires |
|
64 | + * an authenticated user. |
|
65 | + * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead |
|
66 | + */ |
|
67 | + public static function checkLoggedIn() { |
|
68 | + \OC_JSON::checkLoggedIn(); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Check an ajax get/post call if the request token is valid. |
|
73 | - * |
|
74 | - * This method checks for a valid variable 'requesttoken' in $_GET, |
|
75 | - * $_POST and $_SERVER. If a valid token is not found, a json error |
|
76 | - * response will be return and the method will exit from execution |
|
77 | - * of the script. |
|
78 | - * The returned json will be in the format: |
|
79 | - * |
|
80 | - * {"status":"error","data":{"message":"Token expired. Please reload page."}} |
|
81 | - * |
|
82 | - * Add this call to the start of all ajax method files that creates, |
|
83 | - * updates or deletes anything. |
|
84 | - * In cases where you e.g. use an ajax call to load a dialog containing |
|
85 | - * a submittable form, you will need to add the requesttoken first as a |
|
86 | - * parameter to the ajax call, then assign it to the template and finally |
|
87 | - * add a hidden input field also named 'requesttoken' containing the value. |
|
88 | - * @deprecated 8.1.0 Use annotation based CSRF checks from the AppFramework instead |
|
89 | - */ |
|
90 | - public static function callCheck() { |
|
91 | - \OC_JSON::callCheck(); |
|
92 | - } |
|
71 | + /** |
|
72 | + * Check an ajax get/post call if the request token is valid. |
|
73 | + * |
|
74 | + * This method checks for a valid variable 'requesttoken' in $_GET, |
|
75 | + * $_POST and $_SERVER. If a valid token is not found, a json error |
|
76 | + * response will be return and the method will exit from execution |
|
77 | + * of the script. |
|
78 | + * The returned json will be in the format: |
|
79 | + * |
|
80 | + * {"status":"error","data":{"message":"Token expired. Please reload page."}} |
|
81 | + * |
|
82 | + * Add this call to the start of all ajax method files that creates, |
|
83 | + * updates or deletes anything. |
|
84 | + * In cases where you e.g. use an ajax call to load a dialog containing |
|
85 | + * a submittable form, you will need to add the requesttoken first as a |
|
86 | + * parameter to the ajax call, then assign it to the template and finally |
|
87 | + * add a hidden input field also named 'requesttoken' containing the value. |
|
88 | + * @deprecated 8.1.0 Use annotation based CSRF checks from the AppFramework instead |
|
89 | + */ |
|
90 | + public static function callCheck() { |
|
91 | + \OC_JSON::callCheck(); |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Send json success msg |
|
96 | - * |
|
97 | - * Return a json success message with optional extra data. |
|
98 | - * @see OCP\JSON::error() for the format to use. |
|
99 | - * |
|
100 | - * @param array $data The data to use |
|
101 | - * @return string json formatted string. |
|
102 | - * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
103 | - */ |
|
104 | - public static function success( $data = array() ) { |
|
105 | - \OC_JSON::success($data); |
|
106 | - } |
|
94 | + /** |
|
95 | + * Send json success msg |
|
96 | + * |
|
97 | + * Return a json success message with optional extra data. |
|
98 | + * @see OCP\JSON::error() for the format to use. |
|
99 | + * |
|
100 | + * @param array $data The data to use |
|
101 | + * @return string json formatted string. |
|
102 | + * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
103 | + */ |
|
104 | + public static function success( $data = array() ) { |
|
105 | + \OC_JSON::success($data); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * Send json error msg |
|
110 | - * |
|
111 | - * Return a json error message with optional extra data for |
|
112 | - * error message or app specific data. |
|
113 | - * |
|
114 | - * Example use: |
|
115 | - * |
|
116 | - * $id = [some value] |
|
117 | - * OCP\JSON::error(array('data':array('message':'An error happened', 'id': $id))); |
|
118 | - * |
|
119 | - * Will return the json formatted string: |
|
120 | - * |
|
121 | - * {"status":"error","data":{"message":"An error happened", "id":[some value]}} |
|
122 | - * |
|
123 | - * @param array $data The data to use |
|
124 | - * @return string json formatted error string. |
|
125 | - * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
126 | - */ |
|
127 | - public static function error( $data = array() ) { |
|
128 | - \OC_JSON::error( $data ); |
|
129 | - } |
|
108 | + /** |
|
109 | + * Send json error msg |
|
110 | + * |
|
111 | + * Return a json error message with optional extra data for |
|
112 | + * error message or app specific data. |
|
113 | + * |
|
114 | + * Example use: |
|
115 | + * |
|
116 | + * $id = [some value] |
|
117 | + * OCP\JSON::error(array('data':array('message':'An error happened', 'id': $id))); |
|
118 | + * |
|
119 | + * Will return the json formatted string: |
|
120 | + * |
|
121 | + * {"status":"error","data":{"message":"An error happened", "id":[some value]}} |
|
122 | + * |
|
123 | + * @param array $data The data to use |
|
124 | + * @return string json formatted error string. |
|
125 | + * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
126 | + */ |
|
127 | + public static function error( $data = array() ) { |
|
128 | + \OC_JSON::error( $data ); |
|
129 | + } |
|
130 | 130 | |
131 | - /** |
|
132 | - * Set Content-Type header to jsonrequest |
|
133 | - * @param string $type The content type header |
|
134 | - * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
135 | - */ |
|
136 | - public static function setContentTypeHeader( $type='application/json' ) { |
|
137 | - \OC_JSON::setContentTypeHeader($type); |
|
138 | - } |
|
131 | + /** |
|
132 | + * Set Content-Type header to jsonrequest |
|
133 | + * @param string $type The content type header |
|
134 | + * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
135 | + */ |
|
136 | + public static function setContentTypeHeader( $type='application/json' ) { |
|
137 | + \OC_JSON::setContentTypeHeader($type); |
|
138 | + } |
|
139 | 139 | |
140 | - /** |
|
141 | - * Check if the App is enabled and send JSON error message instead |
|
142 | - * |
|
143 | - * This method checks if a specific app is enabled. If not, a json error |
|
144 | - * response will be return and the method will exit from execution |
|
145 | - * of the script. |
|
146 | - * The returned json will be in the format: |
|
147 | - * |
|
148 | - * {"status":"error","data":{"message":"Application is not enabled."}} |
|
149 | - * |
|
150 | - * Add this call to the start of all ajax method files that requires |
|
151 | - * a specific app to be enabled. |
|
152 | - * |
|
153 | - * @param string $app The app to check |
|
154 | - * @deprecated 8.1.0 Use the AppFramework instead. It will automatically check if the app is enabled. |
|
155 | - */ |
|
156 | - public static function checkAppEnabled( $app ) { |
|
157 | - \OC_JSON::checkAppEnabled($app); |
|
158 | - } |
|
140 | + /** |
|
141 | + * Check if the App is enabled and send JSON error message instead |
|
142 | + * |
|
143 | + * This method checks if a specific app is enabled. If not, a json error |
|
144 | + * response will be return and the method will exit from execution |
|
145 | + * of the script. |
|
146 | + * The returned json will be in the format: |
|
147 | + * |
|
148 | + * {"status":"error","data":{"message":"Application is not enabled."}} |
|
149 | + * |
|
150 | + * Add this call to the start of all ajax method files that requires |
|
151 | + * a specific app to be enabled. |
|
152 | + * |
|
153 | + * @param string $app The app to check |
|
154 | + * @deprecated 8.1.0 Use the AppFramework instead. It will automatically check if the app is enabled. |
|
155 | + */ |
|
156 | + public static function checkAppEnabled( $app ) { |
|
157 | + \OC_JSON::checkAppEnabled($app); |
|
158 | + } |
|
159 | 159 | |
160 | - /** |
|
161 | - * Check if the user is a admin, send json error msg if not |
|
162 | - * |
|
163 | - * This method checks if the current user has admin rights. If not, a json error |
|
164 | - * response will be return and the method will exit from execution |
|
165 | - * of the script. |
|
166 | - * The returned json will be in the format: |
|
167 | - * |
|
168 | - * {"status":"error","data":{"message":"Authentication error."}} |
|
169 | - * |
|
170 | - * Add this call to the start of all ajax method files that requires |
|
171 | - * administrative rights. |
|
172 | - * |
|
173 | - * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead |
|
174 | - */ |
|
175 | - public static function checkAdminUser() { |
|
176 | - \OC_JSON::checkAdminUser(); |
|
177 | - } |
|
160 | + /** |
|
161 | + * Check if the user is a admin, send json error msg if not |
|
162 | + * |
|
163 | + * This method checks if the current user has admin rights. If not, a json error |
|
164 | + * response will be return and the method will exit from execution |
|
165 | + * of the script. |
|
166 | + * The returned json will be in the format: |
|
167 | + * |
|
168 | + * {"status":"error","data":{"message":"Authentication error."}} |
|
169 | + * |
|
170 | + * Add this call to the start of all ajax method files that requires |
|
171 | + * administrative rights. |
|
172 | + * |
|
173 | + * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead |
|
174 | + */ |
|
175 | + public static function checkAdminUser() { |
|
176 | + \OC_JSON::checkAdminUser(); |
|
177 | + } |
|
178 | 178 | |
179 | - /** |
|
180 | - * Encode JSON |
|
181 | - * @param array $data |
|
182 | - * @return string |
|
183 | - * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
184 | - */ |
|
185 | - public static function encode($data) { |
|
186 | - return \OC_JSON::encode($data); |
|
187 | - } |
|
179 | + /** |
|
180 | + * Encode JSON |
|
181 | + * @param array $data |
|
182 | + * @return string |
|
183 | + * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
184 | + */ |
|
185 | + public static function encode($data) { |
|
186 | + return \OC_JSON::encode($data); |
|
187 | + } |
|
188 | 188 | |
189 | - /** |
|
190 | - * Check is a given user exists - send json error msg if not |
|
191 | - * @param string $user |
|
192 | - * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
193 | - */ |
|
194 | - public static function checkUserExists($user) { |
|
195 | - \OC_JSON::checkUserExists($user); |
|
196 | - } |
|
189 | + /** |
|
190 | + * Check is a given user exists - send json error msg if not |
|
191 | + * @param string $user |
|
192 | + * @deprecated 8.1.0 Use a AppFramework JSONResponse instead |
|
193 | + */ |
|
194 | + public static function checkUserExists($user) { |
|
195 | + \OC_JSON::checkUserExists($user); |
|
196 | + } |
|
197 | 197 | } |
@@ -52,360 +52,360 @@ |
||
52 | 52 | */ |
53 | 53 | class Share extends \OC\Share\Constants { |
54 | 54 | |
55 | - /** |
|
56 | - * Register a sharing backend class that implements OCP\Share_Backend for an item type |
|
57 | - * @param string $itemType Item type |
|
58 | - * @param string $class Backend class |
|
59 | - * @param string $collectionOf (optional) Depends on item type |
|
60 | - * @param array $supportedFileExtensions (optional) List of supported file extensions if this item type depends on files |
|
61 | - * @return boolean true if backend is registered or false if error |
|
62 | - * @since 5.0.0 |
|
63 | - */ |
|
64 | - public static function registerBackend($itemType, $class, $collectionOf = null, $supportedFileExtensions = null) { |
|
65 | - return \OC\Share\Share::registerBackend($itemType, $class, $collectionOf, $supportedFileExtensions); |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * Check if the Share API is enabled |
|
70 | - * @return boolean true if enabled or false |
|
71 | - * |
|
72 | - * The Share API is enabled by default if not configured |
|
73 | - * @since 5.0.0 |
|
74 | - */ |
|
75 | - public static function isEnabled() { |
|
76 | - return \OC\Share\Share::isEnabled(); |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * Find which users can access a shared item |
|
81 | - * @param string $path to the file |
|
82 | - * @param string $ownerUser owner of the file |
|
83 | - * @param bool $includeOwner include owner to the list of users with access to the file |
|
84 | - * @param bool $returnUserPaths Return an array with the user => path map |
|
85 | - * @param bool $recursive take parent folders into account |
|
86 | - * @return array |
|
87 | - * @note $path needs to be relative to user data dir, e.g. 'file.txt' |
|
88 | - * not '/admin/files/file.txt' |
|
89 | - * @since 5.0.0 - $recursive was added in 9.0.0 |
|
90 | - */ |
|
91 | - public static function getUsersSharingFile($path, $ownerUser, $includeOwner = false, $returnUserPaths = false, $recursive = true) { |
|
92 | - return \OC\Share\Share::getUsersSharingFile( |
|
93 | - $path, |
|
94 | - $ownerUser, |
|
95 | - \OC::$server->getUserManager(), |
|
96 | - \OC::$server->getLogger(), |
|
97 | - $includeOwner, |
|
98 | - $returnUserPaths, |
|
99 | - $recursive |
|
100 | - ); |
|
101 | - } |
|
102 | - |
|
103 | - /** |
|
104 | - * Get the items of item type shared with the current user |
|
105 | - * @param string $itemType |
|
106 | - * @param int $format (optional) Format type must be defined by the backend |
|
107 | - * @param mixed $parameters (optional) |
|
108 | - * @param int $limit Number of items to return (optional) Returns all by default |
|
109 | - * @param bool $includeCollections (optional) |
|
110 | - * @return mixed Return depends on format |
|
111 | - * @since 5.0.0 |
|
112 | - */ |
|
113 | - public static function getItemsSharedWith($itemType, $format = self::FORMAT_NONE, |
|
114 | - $parameters = null, $limit = -1, $includeCollections = false) { |
|
115 | - |
|
116 | - return \OC\Share\Share::getItemsSharedWith($itemType, $format, $parameters, $limit, $includeCollections); |
|
117 | - } |
|
118 | - |
|
119 | - /** |
|
120 | - * Get the items of item type shared with a user |
|
121 | - * @param string $itemType |
|
122 | - * @param string $user for which user we want the shares |
|
123 | - * @param int $format (optional) Format type must be defined by the backend |
|
124 | - * @param mixed $parameters (optional) |
|
125 | - * @param int $limit Number of items to return (optional) Returns all by default |
|
126 | - * @param bool $includeCollections (optional) |
|
127 | - * @return mixed Return depends on format |
|
128 | - * @since 7.0.0 |
|
129 | - */ |
|
130 | - public static function getItemsSharedWithUser($itemType, $user, $format = self::FORMAT_NONE, |
|
131 | - $parameters = null, $limit = -1, $includeCollections = false) { |
|
132 | - |
|
133 | - return \OC\Share\Share::getItemsSharedWithUser($itemType, $user, $format, $parameters, $limit, $includeCollections); |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * Get the item of item type shared with the current user |
|
138 | - * @param string $itemType |
|
139 | - * @param string $itemTarget |
|
140 | - * @param int $format (optional) Format type must be defined by the backend |
|
141 | - * @param mixed $parameters (optional) |
|
142 | - * @param bool $includeCollections (optional) |
|
143 | - * @return mixed Return depends on format |
|
144 | - * @since 5.0.0 |
|
145 | - */ |
|
146 | - public static function getItemSharedWith($itemType, $itemTarget, $format = self::FORMAT_NONE, |
|
147 | - $parameters = null, $includeCollections = false) { |
|
148 | - |
|
149 | - return \OC\Share\Share::getItemSharedWith($itemType, $itemTarget, $format, $parameters, $includeCollections); |
|
150 | - } |
|
151 | - |
|
152 | - /** |
|
153 | - * Get the item of item type shared with a given user by source |
|
154 | - * @param string $itemType |
|
155 | - * @param string $itemSource |
|
156 | - * @param string $user User to whom the item was shared |
|
157 | - * @param string $owner Owner of the share |
|
158 | - * @return array Return list of items with file_target, permissions and expiration |
|
159 | - * @since 6.0.0 - parameter $owner was added in 8.0.0 |
|
160 | - */ |
|
161 | - public static function getItemSharedWithUser($itemType, $itemSource, $user, $owner = null) { |
|
162 | - return \OC\Share\Share::getItemSharedWithUser($itemType, $itemSource, $user, $owner); |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * Get the item of item type shared with the current user by source |
|
167 | - * @param string $itemType |
|
168 | - * @param string $itemSource |
|
169 | - * @param int $format (optional) Format type must be defined by the backend |
|
170 | - * @param mixed $parameters |
|
171 | - * @param bool $includeCollections |
|
172 | - * @return array |
|
173 | - * @since 5.0.0 |
|
174 | - */ |
|
175 | - public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE, |
|
176 | - $parameters = null, $includeCollections = false) { |
|
177 | - return \OC\Share\Share::getItemSharedWithBySource($itemType, $itemSource, $format, $parameters, $includeCollections); |
|
178 | - } |
|
179 | - |
|
180 | - /** |
|
181 | - * Get the item of item type shared by a link |
|
182 | - * @param string $itemType |
|
183 | - * @param string $itemSource |
|
184 | - * @param string $uidOwner Owner of link |
|
185 | - * @return array |
|
186 | - * @since 5.0.0 |
|
187 | - */ |
|
188 | - public static function getItemSharedWithByLink($itemType, $itemSource, $uidOwner) { |
|
189 | - return \OC\Share\Share::getItemSharedWithByLink($itemType, $itemSource, $uidOwner); |
|
190 | - } |
|
191 | - |
|
192 | - /** |
|
193 | - * Based on the given token the share information will be returned - password protected shares will be verified |
|
194 | - * @param string $token |
|
195 | - * @param bool $checkPasswordProtection |
|
196 | - * @return array|bool false will be returned in case the token is unknown or unauthorized |
|
197 | - * @since 5.0.0 - parameter $checkPasswordProtection was added in 7.0.0 |
|
198 | - */ |
|
199 | - public static function getShareByToken($token, $checkPasswordProtection = true) { |
|
200 | - return \OC\Share\Share::getShareByToken($token, $checkPasswordProtection); |
|
201 | - } |
|
202 | - |
|
203 | - /** |
|
204 | - * resolves reshares down to the last real share |
|
205 | - * @param array $linkItem |
|
206 | - * @return array file owner |
|
207 | - * @since 6.0.0 |
|
208 | - */ |
|
209 | - public static function resolveReShare($linkItem) { |
|
210 | - return \OC\Share\Share::resolveReShare($linkItem); |
|
211 | - } |
|
212 | - |
|
213 | - |
|
214 | - /** |
|
215 | - * Get the shared items of item type owned by the current user |
|
216 | - * @param string $itemType |
|
217 | - * @param int $format (optional) Format type must be defined by the backend |
|
218 | - * @param mixed $parameters |
|
219 | - * @param int $limit Number of items to return (optional) Returns all by default |
|
220 | - * @param bool $includeCollections |
|
221 | - * @return mixed Return depends on format |
|
222 | - * @since 5.0.0 |
|
223 | - */ |
|
224 | - public static function getItemsShared($itemType, $format = self::FORMAT_NONE, $parameters = null, |
|
225 | - $limit = -1, $includeCollections = false) { |
|
226 | - |
|
227 | - return \OC\Share\Share::getItemsShared($itemType, $format, $parameters, $limit, $includeCollections); |
|
228 | - } |
|
229 | - |
|
230 | - /** |
|
231 | - * Get the shared item of item type owned by the current user |
|
232 | - * @param string $itemType |
|
233 | - * @param string $itemSource |
|
234 | - * @param int $format (optional) Format type must be defined by the backend |
|
235 | - * @param mixed $parameters |
|
236 | - * @param bool $includeCollections |
|
237 | - * @return mixed Return depends on format |
|
238 | - * @since 5.0.0 |
|
239 | - */ |
|
240 | - public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE, |
|
241 | - $parameters = null, $includeCollections = false) { |
|
242 | - |
|
243 | - return \OC\Share\Share::getItemShared($itemType, $itemSource, $format, $parameters, $includeCollections); |
|
244 | - } |
|
245 | - |
|
246 | - /** |
|
247 | - * Get all users an item is shared with |
|
248 | - * @param string $itemType |
|
249 | - * @param string $itemSource |
|
250 | - * @param string $uidOwner |
|
251 | - * @param bool $includeCollections |
|
252 | - * @param bool $checkExpireDate |
|
253 | - * @return array Return array of users |
|
254 | - * @since 5.0.0 - parameter $checkExpireDate was added in 7.0.0 |
|
255 | - */ |
|
256 | - public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false, $checkExpireDate = true) { |
|
257 | - return \OC\Share\Share::getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections, $checkExpireDate); |
|
258 | - } |
|
259 | - |
|
260 | - /** |
|
261 | - * Share an item with a user, group, or via private link |
|
262 | - * @param string $itemType |
|
263 | - * @param string $itemSource |
|
264 | - * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
265 | - * @param string $shareWith User or group the item is being shared with |
|
266 | - * @param int $permissions CRUDS |
|
267 | - * @param string $itemSourceName |
|
268 | - * @param \DateTime $expirationDate |
|
269 | - * @param bool $passwordChanged |
|
270 | - * @return bool|string Returns true on success or false on failure, Returns token on success for links |
|
271 | - * @throws \OC\HintException when the share type is remote and the shareWith is invalid |
|
272 | - * @throws \Exception |
|
273 | - * @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 |
|
274 | - */ |
|
275 | - public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null, \DateTime $expirationDate = null, $passwordChanged = null) { |
|
276 | - return \OC\Share\Share::shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName, $expirationDate, $passwordChanged); |
|
277 | - } |
|
278 | - |
|
279 | - /** |
|
280 | - * Unshare an item from a user, group, or delete a private link |
|
281 | - * @param string $itemType |
|
282 | - * @param string $itemSource |
|
283 | - * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
284 | - * @param string $shareWith User or group the item is being shared with |
|
285 | - * @param string $owner owner of the share, if null the current user is used |
|
286 | - * @return boolean true on success or false on failure |
|
287 | - * @since 5.0.0 - parameter $owner was added in 8.0.0 |
|
288 | - */ |
|
289 | - public static function unshare($itemType, $itemSource, $shareType, $shareWith, $owner = null) { |
|
290 | - return \OC\Share\Share::unshare($itemType, $itemSource, $shareType, $shareWith, $owner); |
|
291 | - } |
|
292 | - |
|
293 | - /** |
|
294 | - * Unshare an item from all users, groups, and remove all links |
|
295 | - * @param string $itemType |
|
296 | - * @param string $itemSource |
|
297 | - * @return boolean true on success or false on failure |
|
298 | - * @since 5.0.0 |
|
299 | - */ |
|
300 | - public static function unshareAll($itemType, $itemSource) { |
|
301 | - return \OC\Share\Share::unshareAll($itemType, $itemSource); |
|
302 | - } |
|
303 | - |
|
304 | - /** |
|
305 | - * Unshare an item shared with the current user |
|
306 | - * @param string $itemType |
|
307 | - * @param string $itemOrigin Item target or source |
|
308 | - * @param boolean $originIsSource true if $itemOrigin is the source, false if $itemOrigin is the target (optional) |
|
309 | - * @return boolean true on success or false on failure |
|
310 | - * |
|
311 | - * Unsharing from self is not allowed for items inside collections |
|
312 | - * @since 5.0.0 - parameter $originIsSource was added in 8.0.0 |
|
313 | - */ |
|
314 | - public static function unshareFromSelf($itemType, $itemOrigin, $originIsSource = false) { |
|
315 | - return \OC\Share\Share::unshareFromSelf($itemType, $itemOrigin, $originIsSource); |
|
316 | - } |
|
317 | - |
|
318 | - /** |
|
319 | - * sent status if users got informed by mail about share |
|
320 | - * @param string $itemType |
|
321 | - * @param string $itemSource |
|
322 | - * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
323 | - * @param string $recipient with whom was the item shared |
|
324 | - * @param bool $status |
|
325 | - * @since 6.0.0 - parameter $originIsSource was added in 8.0.0 |
|
326 | - */ |
|
327 | - public static function setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status) { |
|
328 | - return \OC\Share\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status); |
|
329 | - } |
|
330 | - |
|
331 | - /** |
|
332 | - * Set the permissions of an item for a specific user or group |
|
333 | - * @param string $itemType |
|
334 | - * @param string $itemSource |
|
335 | - * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
336 | - * @param string $shareWith User or group the item is being shared with |
|
337 | - * @param int $permissions CRUDS permissions |
|
338 | - * @return boolean true on success or false on failure |
|
339 | - * @since 5.0.0 |
|
340 | - */ |
|
341 | - public static function setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions) { |
|
342 | - return \OC\Share\Share::setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions); |
|
343 | - } |
|
344 | - |
|
345 | - /** |
|
346 | - * Set expiration date for a share |
|
347 | - * @param string $itemType |
|
348 | - * @param string $itemSource |
|
349 | - * @param string $date expiration date |
|
350 | - * @param int $shareTime timestamp from when the file was shared |
|
351 | - * @return boolean |
|
352 | - * @since 5.0.0 - parameter $shareTime was added in 8.0.0 |
|
353 | - */ |
|
354 | - public static function setExpirationDate($itemType, $itemSource, $date, $shareTime = null) { |
|
355 | - return \OC\Share\Share::setExpirationDate($itemType, $itemSource, $date, $shareTime); |
|
356 | - } |
|
357 | - |
|
358 | - /** |
|
359 | - * Set password for a public link share |
|
360 | - * @param int $shareId |
|
361 | - * @param string $password |
|
362 | - * @return boolean |
|
363 | - * @since 8.1.0 |
|
364 | - */ |
|
365 | - public static function setPassword($shareId, $password) { |
|
366 | - $userSession = \OC::$server->getUserSession(); |
|
367 | - $connection = \OC::$server->getDatabaseConnection(); |
|
368 | - $config = \OC::$server->getConfig(); |
|
369 | - return \OC\Share\Share::setPassword($userSession, $connection, $config, $shareId, $password); |
|
370 | - } |
|
371 | - |
|
372 | - |
|
373 | - /** |
|
374 | - * Get the backend class for the specified item type |
|
375 | - * @param string $itemType |
|
376 | - * @return Share_Backend |
|
377 | - * @since 5.0.0 |
|
378 | - */ |
|
379 | - public static function getBackend($itemType) { |
|
380 | - return \OC\Share\Share::getBackend($itemType); |
|
381 | - } |
|
382 | - |
|
383 | - /** |
|
384 | - * Delete all shares with type SHARE_TYPE_LINK |
|
385 | - * @since 6.0.0 |
|
386 | - */ |
|
387 | - public static function removeAllLinkShares() { |
|
388 | - return \OC\Share\Share::removeAllLinkShares(); |
|
389 | - } |
|
390 | - |
|
391 | - /** |
|
392 | - * In case a password protected link is not yet authenticated this function will return false |
|
393 | - * |
|
394 | - * @param array $linkItem |
|
395 | - * @return bool |
|
396 | - * @since 7.0.0 |
|
397 | - */ |
|
398 | - public static function checkPasswordProtectedShare(array $linkItem) { |
|
399 | - return \OC\Share\Share::checkPasswordProtectedShare($linkItem); |
|
400 | - } |
|
401 | - |
|
402 | - /** |
|
403 | - * Check if resharing is allowed |
|
404 | - * |
|
405 | - * @return boolean true if allowed or false |
|
406 | - * @since 5.0.0 |
|
407 | - */ |
|
408 | - public static function isResharingAllowed() { |
|
409 | - return \OC\Share\Share::isResharingAllowed(); |
|
410 | - } |
|
55 | + /** |
|
56 | + * Register a sharing backend class that implements OCP\Share_Backend for an item type |
|
57 | + * @param string $itemType Item type |
|
58 | + * @param string $class Backend class |
|
59 | + * @param string $collectionOf (optional) Depends on item type |
|
60 | + * @param array $supportedFileExtensions (optional) List of supported file extensions if this item type depends on files |
|
61 | + * @return boolean true if backend is registered or false if error |
|
62 | + * @since 5.0.0 |
|
63 | + */ |
|
64 | + public static function registerBackend($itemType, $class, $collectionOf = null, $supportedFileExtensions = null) { |
|
65 | + return \OC\Share\Share::registerBackend($itemType, $class, $collectionOf, $supportedFileExtensions); |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * Check if the Share API is enabled |
|
70 | + * @return boolean true if enabled or false |
|
71 | + * |
|
72 | + * The Share API is enabled by default if not configured |
|
73 | + * @since 5.0.0 |
|
74 | + */ |
|
75 | + public static function isEnabled() { |
|
76 | + return \OC\Share\Share::isEnabled(); |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * Find which users can access a shared item |
|
81 | + * @param string $path to the file |
|
82 | + * @param string $ownerUser owner of the file |
|
83 | + * @param bool $includeOwner include owner to the list of users with access to the file |
|
84 | + * @param bool $returnUserPaths Return an array with the user => path map |
|
85 | + * @param bool $recursive take parent folders into account |
|
86 | + * @return array |
|
87 | + * @note $path needs to be relative to user data dir, e.g. 'file.txt' |
|
88 | + * not '/admin/files/file.txt' |
|
89 | + * @since 5.0.0 - $recursive was added in 9.0.0 |
|
90 | + */ |
|
91 | + public static function getUsersSharingFile($path, $ownerUser, $includeOwner = false, $returnUserPaths = false, $recursive = true) { |
|
92 | + return \OC\Share\Share::getUsersSharingFile( |
|
93 | + $path, |
|
94 | + $ownerUser, |
|
95 | + \OC::$server->getUserManager(), |
|
96 | + \OC::$server->getLogger(), |
|
97 | + $includeOwner, |
|
98 | + $returnUserPaths, |
|
99 | + $recursive |
|
100 | + ); |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * Get the items of item type shared with the current user |
|
105 | + * @param string $itemType |
|
106 | + * @param int $format (optional) Format type must be defined by the backend |
|
107 | + * @param mixed $parameters (optional) |
|
108 | + * @param int $limit Number of items to return (optional) Returns all by default |
|
109 | + * @param bool $includeCollections (optional) |
|
110 | + * @return mixed Return depends on format |
|
111 | + * @since 5.0.0 |
|
112 | + */ |
|
113 | + public static function getItemsSharedWith($itemType, $format = self::FORMAT_NONE, |
|
114 | + $parameters = null, $limit = -1, $includeCollections = false) { |
|
115 | + |
|
116 | + return \OC\Share\Share::getItemsSharedWith($itemType, $format, $parameters, $limit, $includeCollections); |
|
117 | + } |
|
118 | + |
|
119 | + /** |
|
120 | + * Get the items of item type shared with a user |
|
121 | + * @param string $itemType |
|
122 | + * @param string $user for which user we want the shares |
|
123 | + * @param int $format (optional) Format type must be defined by the backend |
|
124 | + * @param mixed $parameters (optional) |
|
125 | + * @param int $limit Number of items to return (optional) Returns all by default |
|
126 | + * @param bool $includeCollections (optional) |
|
127 | + * @return mixed Return depends on format |
|
128 | + * @since 7.0.0 |
|
129 | + */ |
|
130 | + public static function getItemsSharedWithUser($itemType, $user, $format = self::FORMAT_NONE, |
|
131 | + $parameters = null, $limit = -1, $includeCollections = false) { |
|
132 | + |
|
133 | + return \OC\Share\Share::getItemsSharedWithUser($itemType, $user, $format, $parameters, $limit, $includeCollections); |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * Get the item of item type shared with the current user |
|
138 | + * @param string $itemType |
|
139 | + * @param string $itemTarget |
|
140 | + * @param int $format (optional) Format type must be defined by the backend |
|
141 | + * @param mixed $parameters (optional) |
|
142 | + * @param bool $includeCollections (optional) |
|
143 | + * @return mixed Return depends on format |
|
144 | + * @since 5.0.0 |
|
145 | + */ |
|
146 | + public static function getItemSharedWith($itemType, $itemTarget, $format = self::FORMAT_NONE, |
|
147 | + $parameters = null, $includeCollections = false) { |
|
148 | + |
|
149 | + return \OC\Share\Share::getItemSharedWith($itemType, $itemTarget, $format, $parameters, $includeCollections); |
|
150 | + } |
|
151 | + |
|
152 | + /** |
|
153 | + * Get the item of item type shared with a given user by source |
|
154 | + * @param string $itemType |
|
155 | + * @param string $itemSource |
|
156 | + * @param string $user User to whom the item was shared |
|
157 | + * @param string $owner Owner of the share |
|
158 | + * @return array Return list of items with file_target, permissions and expiration |
|
159 | + * @since 6.0.0 - parameter $owner was added in 8.0.0 |
|
160 | + */ |
|
161 | + public static function getItemSharedWithUser($itemType, $itemSource, $user, $owner = null) { |
|
162 | + return \OC\Share\Share::getItemSharedWithUser($itemType, $itemSource, $user, $owner); |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * Get the item of item type shared with the current user by source |
|
167 | + * @param string $itemType |
|
168 | + * @param string $itemSource |
|
169 | + * @param int $format (optional) Format type must be defined by the backend |
|
170 | + * @param mixed $parameters |
|
171 | + * @param bool $includeCollections |
|
172 | + * @return array |
|
173 | + * @since 5.0.0 |
|
174 | + */ |
|
175 | + public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE, |
|
176 | + $parameters = null, $includeCollections = false) { |
|
177 | + return \OC\Share\Share::getItemSharedWithBySource($itemType, $itemSource, $format, $parameters, $includeCollections); |
|
178 | + } |
|
179 | + |
|
180 | + /** |
|
181 | + * Get the item of item type shared by a link |
|
182 | + * @param string $itemType |
|
183 | + * @param string $itemSource |
|
184 | + * @param string $uidOwner Owner of link |
|
185 | + * @return array |
|
186 | + * @since 5.0.0 |
|
187 | + */ |
|
188 | + public static function getItemSharedWithByLink($itemType, $itemSource, $uidOwner) { |
|
189 | + return \OC\Share\Share::getItemSharedWithByLink($itemType, $itemSource, $uidOwner); |
|
190 | + } |
|
191 | + |
|
192 | + /** |
|
193 | + * Based on the given token the share information will be returned - password protected shares will be verified |
|
194 | + * @param string $token |
|
195 | + * @param bool $checkPasswordProtection |
|
196 | + * @return array|bool false will be returned in case the token is unknown or unauthorized |
|
197 | + * @since 5.0.0 - parameter $checkPasswordProtection was added in 7.0.0 |
|
198 | + */ |
|
199 | + public static function getShareByToken($token, $checkPasswordProtection = true) { |
|
200 | + return \OC\Share\Share::getShareByToken($token, $checkPasswordProtection); |
|
201 | + } |
|
202 | + |
|
203 | + /** |
|
204 | + * resolves reshares down to the last real share |
|
205 | + * @param array $linkItem |
|
206 | + * @return array file owner |
|
207 | + * @since 6.0.0 |
|
208 | + */ |
|
209 | + public static function resolveReShare($linkItem) { |
|
210 | + return \OC\Share\Share::resolveReShare($linkItem); |
|
211 | + } |
|
212 | + |
|
213 | + |
|
214 | + /** |
|
215 | + * Get the shared items of item type owned by the current user |
|
216 | + * @param string $itemType |
|
217 | + * @param int $format (optional) Format type must be defined by the backend |
|
218 | + * @param mixed $parameters |
|
219 | + * @param int $limit Number of items to return (optional) Returns all by default |
|
220 | + * @param bool $includeCollections |
|
221 | + * @return mixed Return depends on format |
|
222 | + * @since 5.0.0 |
|
223 | + */ |
|
224 | + public static function getItemsShared($itemType, $format = self::FORMAT_NONE, $parameters = null, |
|
225 | + $limit = -1, $includeCollections = false) { |
|
226 | + |
|
227 | + return \OC\Share\Share::getItemsShared($itemType, $format, $parameters, $limit, $includeCollections); |
|
228 | + } |
|
229 | + |
|
230 | + /** |
|
231 | + * Get the shared item of item type owned by the current user |
|
232 | + * @param string $itemType |
|
233 | + * @param string $itemSource |
|
234 | + * @param int $format (optional) Format type must be defined by the backend |
|
235 | + * @param mixed $parameters |
|
236 | + * @param bool $includeCollections |
|
237 | + * @return mixed Return depends on format |
|
238 | + * @since 5.0.0 |
|
239 | + */ |
|
240 | + public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE, |
|
241 | + $parameters = null, $includeCollections = false) { |
|
242 | + |
|
243 | + return \OC\Share\Share::getItemShared($itemType, $itemSource, $format, $parameters, $includeCollections); |
|
244 | + } |
|
245 | + |
|
246 | + /** |
|
247 | + * Get all users an item is shared with |
|
248 | + * @param string $itemType |
|
249 | + * @param string $itemSource |
|
250 | + * @param string $uidOwner |
|
251 | + * @param bool $includeCollections |
|
252 | + * @param bool $checkExpireDate |
|
253 | + * @return array Return array of users |
|
254 | + * @since 5.0.0 - parameter $checkExpireDate was added in 7.0.0 |
|
255 | + */ |
|
256 | + public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false, $checkExpireDate = true) { |
|
257 | + return \OC\Share\Share::getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections, $checkExpireDate); |
|
258 | + } |
|
259 | + |
|
260 | + /** |
|
261 | + * Share an item with a user, group, or via private link |
|
262 | + * @param string $itemType |
|
263 | + * @param string $itemSource |
|
264 | + * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
265 | + * @param string $shareWith User or group the item is being shared with |
|
266 | + * @param int $permissions CRUDS |
|
267 | + * @param string $itemSourceName |
|
268 | + * @param \DateTime $expirationDate |
|
269 | + * @param bool $passwordChanged |
|
270 | + * @return bool|string Returns true on success or false on failure, Returns token on success for links |
|
271 | + * @throws \OC\HintException when the share type is remote and the shareWith is invalid |
|
272 | + * @throws \Exception |
|
273 | + * @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 |
|
274 | + */ |
|
275 | + public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null, \DateTime $expirationDate = null, $passwordChanged = null) { |
|
276 | + return \OC\Share\Share::shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName, $expirationDate, $passwordChanged); |
|
277 | + } |
|
278 | + |
|
279 | + /** |
|
280 | + * Unshare an item from a user, group, or delete a private link |
|
281 | + * @param string $itemType |
|
282 | + * @param string $itemSource |
|
283 | + * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
284 | + * @param string $shareWith User or group the item is being shared with |
|
285 | + * @param string $owner owner of the share, if null the current user is used |
|
286 | + * @return boolean true on success or false on failure |
|
287 | + * @since 5.0.0 - parameter $owner was added in 8.0.0 |
|
288 | + */ |
|
289 | + public static function unshare($itemType, $itemSource, $shareType, $shareWith, $owner = null) { |
|
290 | + return \OC\Share\Share::unshare($itemType, $itemSource, $shareType, $shareWith, $owner); |
|
291 | + } |
|
292 | + |
|
293 | + /** |
|
294 | + * Unshare an item from all users, groups, and remove all links |
|
295 | + * @param string $itemType |
|
296 | + * @param string $itemSource |
|
297 | + * @return boolean true on success or false on failure |
|
298 | + * @since 5.0.0 |
|
299 | + */ |
|
300 | + public static function unshareAll($itemType, $itemSource) { |
|
301 | + return \OC\Share\Share::unshareAll($itemType, $itemSource); |
|
302 | + } |
|
303 | + |
|
304 | + /** |
|
305 | + * Unshare an item shared with the current user |
|
306 | + * @param string $itemType |
|
307 | + * @param string $itemOrigin Item target or source |
|
308 | + * @param boolean $originIsSource true if $itemOrigin is the source, false if $itemOrigin is the target (optional) |
|
309 | + * @return boolean true on success or false on failure |
|
310 | + * |
|
311 | + * Unsharing from self is not allowed for items inside collections |
|
312 | + * @since 5.0.0 - parameter $originIsSource was added in 8.0.0 |
|
313 | + */ |
|
314 | + public static function unshareFromSelf($itemType, $itemOrigin, $originIsSource = false) { |
|
315 | + return \OC\Share\Share::unshareFromSelf($itemType, $itemOrigin, $originIsSource); |
|
316 | + } |
|
317 | + |
|
318 | + /** |
|
319 | + * sent status if users got informed by mail about share |
|
320 | + * @param string $itemType |
|
321 | + * @param string $itemSource |
|
322 | + * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
323 | + * @param string $recipient with whom was the item shared |
|
324 | + * @param bool $status |
|
325 | + * @since 6.0.0 - parameter $originIsSource was added in 8.0.0 |
|
326 | + */ |
|
327 | + public static function setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status) { |
|
328 | + return \OC\Share\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status); |
|
329 | + } |
|
330 | + |
|
331 | + /** |
|
332 | + * Set the permissions of an item for a specific user or group |
|
333 | + * @param string $itemType |
|
334 | + * @param string $itemSource |
|
335 | + * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK |
|
336 | + * @param string $shareWith User or group the item is being shared with |
|
337 | + * @param int $permissions CRUDS permissions |
|
338 | + * @return boolean true on success or false on failure |
|
339 | + * @since 5.0.0 |
|
340 | + */ |
|
341 | + public static function setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions) { |
|
342 | + return \OC\Share\Share::setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions); |
|
343 | + } |
|
344 | + |
|
345 | + /** |
|
346 | + * Set expiration date for a share |
|
347 | + * @param string $itemType |
|
348 | + * @param string $itemSource |
|
349 | + * @param string $date expiration date |
|
350 | + * @param int $shareTime timestamp from when the file was shared |
|
351 | + * @return boolean |
|
352 | + * @since 5.0.0 - parameter $shareTime was added in 8.0.0 |
|
353 | + */ |
|
354 | + public static function setExpirationDate($itemType, $itemSource, $date, $shareTime = null) { |
|
355 | + return \OC\Share\Share::setExpirationDate($itemType, $itemSource, $date, $shareTime); |
|
356 | + } |
|
357 | + |
|
358 | + /** |
|
359 | + * Set password for a public link share |
|
360 | + * @param int $shareId |
|
361 | + * @param string $password |
|
362 | + * @return boolean |
|
363 | + * @since 8.1.0 |
|
364 | + */ |
|
365 | + public static function setPassword($shareId, $password) { |
|
366 | + $userSession = \OC::$server->getUserSession(); |
|
367 | + $connection = \OC::$server->getDatabaseConnection(); |
|
368 | + $config = \OC::$server->getConfig(); |
|
369 | + return \OC\Share\Share::setPassword($userSession, $connection, $config, $shareId, $password); |
|
370 | + } |
|
371 | + |
|
372 | + |
|
373 | + /** |
|
374 | + * Get the backend class for the specified item type |
|
375 | + * @param string $itemType |
|
376 | + * @return Share_Backend |
|
377 | + * @since 5.0.0 |
|
378 | + */ |
|
379 | + public static function getBackend($itemType) { |
|
380 | + return \OC\Share\Share::getBackend($itemType); |
|
381 | + } |
|
382 | + |
|
383 | + /** |
|
384 | + * Delete all shares with type SHARE_TYPE_LINK |
|
385 | + * @since 6.0.0 |
|
386 | + */ |
|
387 | + public static function removeAllLinkShares() { |
|
388 | + return \OC\Share\Share::removeAllLinkShares(); |
|
389 | + } |
|
390 | + |
|
391 | + /** |
|
392 | + * In case a password protected link is not yet authenticated this function will return false |
|
393 | + * |
|
394 | + * @param array $linkItem |
|
395 | + * @return bool |
|
396 | + * @since 7.0.0 |
|
397 | + */ |
|
398 | + public static function checkPasswordProtectedShare(array $linkItem) { |
|
399 | + return \OC\Share\Share::checkPasswordProtectedShare($linkItem); |
|
400 | + } |
|
401 | + |
|
402 | + /** |
|
403 | + * Check if resharing is allowed |
|
404 | + * |
|
405 | + * @return boolean true if allowed or false |
|
406 | + * @since 5.0.0 |
|
407 | + */ |
|
408 | + public static function isResharingAllowed() { |
|
409 | + return \OC\Share\Share::isResharingAllowed(); |
|
410 | + } |
|
411 | 411 | } |
@@ -43,69 +43,69 @@ |
||
43 | 43 | * @since 6.0.0 |
44 | 44 | */ |
45 | 45 | interface IL10N { |
46 | - /** |
|
47 | - * Translating |
|
48 | - * @param string $text The text we need a translation for |
|
49 | - * @param array $parameters default:array() Parameters for sprintf |
|
50 | - * @return \OC_L10N_String Translation or the same text |
|
51 | - * |
|
52 | - * Returns the translation. If no translation is found, $text will be |
|
53 | - * returned. |
|
54 | - * @since 6.0.0 |
|
55 | - */ |
|
56 | - public function t($text, $parameters = array()); |
|
46 | + /** |
|
47 | + * Translating |
|
48 | + * @param string $text The text we need a translation for |
|
49 | + * @param array $parameters default:array() Parameters for sprintf |
|
50 | + * @return \OC_L10N_String Translation or the same text |
|
51 | + * |
|
52 | + * Returns the translation. If no translation is found, $text will be |
|
53 | + * returned. |
|
54 | + * @since 6.0.0 |
|
55 | + */ |
|
56 | + public function t($text, $parameters = array()); |
|
57 | 57 | |
58 | - /** |
|
59 | - * Translating |
|
60 | - * @param string $text_singular the string to translate for exactly one object |
|
61 | - * @param string $text_plural the string to translate for n objects |
|
62 | - * @param integer $count Number of objects |
|
63 | - * @param array $parameters default:array() Parameters for sprintf |
|
64 | - * @return \OC_L10N_String Translation or the same text |
|
65 | - * |
|
66 | - * Returns the translation. If no translation is found, $text will be |
|
67 | - * returned. %n will be replaced with the number of objects. |
|
68 | - * |
|
69 | - * The correct plural is determined by the plural_forms-function |
|
70 | - * provided by the po file. |
|
71 | - * @since 6.0.0 |
|
72 | - * |
|
73 | - */ |
|
74 | - public function n($text_singular, $text_plural, $count, $parameters = array()); |
|
58 | + /** |
|
59 | + * Translating |
|
60 | + * @param string $text_singular the string to translate for exactly one object |
|
61 | + * @param string $text_plural the string to translate for n objects |
|
62 | + * @param integer $count Number of objects |
|
63 | + * @param array $parameters default:array() Parameters for sprintf |
|
64 | + * @return \OC_L10N_String Translation or the same text |
|
65 | + * |
|
66 | + * Returns the translation. If no translation is found, $text will be |
|
67 | + * returned. %n will be replaced with the number of objects. |
|
68 | + * |
|
69 | + * The correct plural is determined by the plural_forms-function |
|
70 | + * provided by the po file. |
|
71 | + * @since 6.0.0 |
|
72 | + * |
|
73 | + */ |
|
74 | + public function n($text_singular, $text_plural, $count, $parameters = array()); |
|
75 | 75 | |
76 | - /** |
|
77 | - * Localization |
|
78 | - * @param string $type Type of localization |
|
79 | - * @param \DateTime|int|string $data parameters for this localization |
|
80 | - * @param array $options currently supports following options: |
|
81 | - * - 'width': handed into \Punic\Calendar::formatDate as second parameter |
|
82 | - * @return string|int|false |
|
83 | - * |
|
84 | - * Returns the localized data. |
|
85 | - * |
|
86 | - * Implemented types: |
|
87 | - * - date |
|
88 | - * - Creates a date |
|
89 | - * - l10n-field: date |
|
90 | - * - params: timestamp (int/string) |
|
91 | - * - datetime |
|
92 | - * - Creates date and time |
|
93 | - * - l10n-field: datetime |
|
94 | - * - params: timestamp (int/string) |
|
95 | - * - time |
|
96 | - * - Creates a time |
|
97 | - * - l10n-field: time |
|
98 | - * - params: timestamp (int/string) |
|
99 | - * @since 6.0.0 - parameter $options was added in 8.0.0 |
|
100 | - */ |
|
101 | - public function l($type, $data, $options = array()); |
|
76 | + /** |
|
77 | + * Localization |
|
78 | + * @param string $type Type of localization |
|
79 | + * @param \DateTime|int|string $data parameters for this localization |
|
80 | + * @param array $options currently supports following options: |
|
81 | + * - 'width': handed into \Punic\Calendar::formatDate as second parameter |
|
82 | + * @return string|int|false |
|
83 | + * |
|
84 | + * Returns the localized data. |
|
85 | + * |
|
86 | + * Implemented types: |
|
87 | + * - date |
|
88 | + * - Creates a date |
|
89 | + * - l10n-field: date |
|
90 | + * - params: timestamp (int/string) |
|
91 | + * - datetime |
|
92 | + * - Creates date and time |
|
93 | + * - l10n-field: datetime |
|
94 | + * - params: timestamp (int/string) |
|
95 | + * - time |
|
96 | + * - Creates a time |
|
97 | + * - l10n-field: time |
|
98 | + * - params: timestamp (int/string) |
|
99 | + * @since 6.0.0 - parameter $options was added in 8.0.0 |
|
100 | + */ |
|
101 | + public function l($type, $data, $options = array()); |
|
102 | 102 | |
103 | 103 | |
104 | - /** |
|
105 | - * The code (en, de, ...) of the language that is used for this IL10N object |
|
106 | - * |
|
107 | - * @return string language |
|
108 | - * @since 7.0.0 |
|
109 | - */ |
|
110 | - public function getLanguageCode(); |
|
104 | + /** |
|
105 | + * The code (en, de, ...) of the language that is used for this IL10N object |
|
106 | + * |
|
107 | + * @return string language |
|
108 | + * @since 7.0.0 |
|
109 | + */ |
|
110 | + public function getLanguageCode(); |
|
111 | 111 | } |
@@ -31,64 +31,64 @@ |
||
31 | 31 | // use OCP namespace for all classes that are considered public. |
32 | 32 | // This means that they should be used by apps instead of the internal ownCloud classes |
33 | 33 | namespace OCP { |
34 | - /** |
|
35 | - * Interface IAddressBook |
|
36 | - * |
|
37 | - * @package OCP |
|
38 | - * @since 5.0.0 |
|
39 | - */ |
|
40 | - interface IAddressBook { |
|
34 | + /** |
|
35 | + * Interface IAddressBook |
|
36 | + * |
|
37 | + * @package OCP |
|
38 | + * @since 5.0.0 |
|
39 | + */ |
|
40 | + interface IAddressBook { |
|
41 | 41 | |
42 | - /** |
|
43 | - * @return string defining the technical unique key |
|
44 | - * @since 5.0.0 |
|
45 | - */ |
|
46 | - public function getKey(); |
|
42 | + /** |
|
43 | + * @return string defining the technical unique key |
|
44 | + * @since 5.0.0 |
|
45 | + */ |
|
46 | + public function getKey(); |
|
47 | 47 | |
48 | - /** |
|
49 | - * In comparison to getKey() this function returns a human readable (maybe translated) name |
|
50 | - * @return mixed |
|
51 | - * @since 5.0.0 |
|
52 | - */ |
|
53 | - public function getDisplayName(); |
|
48 | + /** |
|
49 | + * In comparison to getKey() this function returns a human readable (maybe translated) name |
|
50 | + * @return mixed |
|
51 | + * @since 5.0.0 |
|
52 | + */ |
|
53 | + public function getDisplayName(); |
|
54 | 54 | |
55 | - /** |
|
56 | - * @param string $pattern which should match within the $searchProperties |
|
57 | - * @param array $searchProperties defines the properties within the query pattern should match |
|
58 | - * @param array $options - for future use. One should always have options! |
|
59 | - * @return array an array of contacts which are arrays of key-value-pairs |
|
60 | - * @since 5.0.0 |
|
61 | - */ |
|
62 | - public function search($pattern, $searchProperties, $options); |
|
63 | - // // dummy results |
|
64 | - // return array( |
|
65 | - // array('id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => '[email protected]', 'GEO' => '37.386013;-122.082932'), |
|
66 | - // array('id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => array('[email protected]', '[email protected]')), |
|
67 | - // ); |
|
55 | + /** |
|
56 | + * @param string $pattern which should match within the $searchProperties |
|
57 | + * @param array $searchProperties defines the properties within the query pattern should match |
|
58 | + * @param array $options - for future use. One should always have options! |
|
59 | + * @return array an array of contacts which are arrays of key-value-pairs |
|
60 | + * @since 5.0.0 |
|
61 | + */ |
|
62 | + public function search($pattern, $searchProperties, $options); |
|
63 | + // // dummy results |
|
64 | + // return array( |
|
65 | + // array('id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => '[email protected]', 'GEO' => '37.386013;-122.082932'), |
|
66 | + // array('id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => array('[email protected]', '[email protected]')), |
|
67 | + // ); |
|
68 | 68 | |
69 | - /** |
|
70 | - * @param array $properties this array if key-value-pairs defines a contact |
|
71 | - * @return array an array representing the contact just created or updated |
|
72 | - * @since 5.0.0 |
|
73 | - */ |
|
74 | - public function createOrUpdate($properties); |
|
75 | - // // dummy |
|
76 | - // return array('id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => '[email protected]', |
|
77 | - // 'PHOTO' => 'VALUE=uri:http://www.abc.com/pub/photos/jqpublic.gif', |
|
78 | - // 'ADR' => ';;123 Main Street;Any Town;CA;91921-1234' |
|
79 | - // ); |
|
69 | + /** |
|
70 | + * @param array $properties this array if key-value-pairs defines a contact |
|
71 | + * @return array an array representing the contact just created or updated |
|
72 | + * @since 5.0.0 |
|
73 | + */ |
|
74 | + public function createOrUpdate($properties); |
|
75 | + // // dummy |
|
76 | + // return array('id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => '[email protected]', |
|
77 | + // 'PHOTO' => 'VALUE=uri:http://www.abc.com/pub/photos/jqpublic.gif', |
|
78 | + // 'ADR' => ';;123 Main Street;Any Town;CA;91921-1234' |
|
79 | + // ); |
|
80 | 80 | |
81 | - /** |
|
82 | - * @return mixed |
|
83 | - * @since 5.0.0 |
|
84 | - */ |
|
85 | - public function getPermissions(); |
|
81 | + /** |
|
82 | + * @return mixed |
|
83 | + * @since 5.0.0 |
|
84 | + */ |
|
85 | + public function getPermissions(); |
|
86 | 86 | |
87 | - /** |
|
88 | - * @param object $id the unique identifier to a contact |
|
89 | - * @return bool successful or not |
|
90 | - * @since 5.0.0 |
|
91 | - */ |
|
92 | - public function delete($id); |
|
93 | - } |
|
87 | + /** |
|
88 | + * @param object $id the unique identifier to a contact |
|
89 | + * @return bool successful or not |
|
90 | + * @since 5.0.0 |
|
91 | + */ |
|
92 | + public function delete($id); |
|
93 | + } |
|
94 | 94 | } |
@@ -29,77 +29,77 @@ |
||
29 | 29 | * @since 11.0.0 |
30 | 30 | */ |
31 | 31 | interface ILDAPProvider { |
32 | - /** |
|
33 | - * Translate a user id to LDAP DN. |
|
34 | - * @param string $uid user id |
|
35 | - * @return string |
|
36 | - * @since 11.0.0 |
|
37 | - */ |
|
38 | - public function getUserDN($uid); |
|
32 | + /** |
|
33 | + * Translate a user id to LDAP DN. |
|
34 | + * @param string $uid user id |
|
35 | + * @return string |
|
36 | + * @since 11.0.0 |
|
37 | + */ |
|
38 | + public function getUserDN($uid); |
|
39 | 39 | |
40 | - /** |
|
41 | - * Translate a LDAP DN to an internal user name. |
|
42 | - * @param string $dn LDAP DN |
|
43 | - * @return string with the internal user name |
|
44 | - * @throws \Exception if translation was unsuccessful |
|
45 | - * @since 11.0.0 |
|
46 | - */ |
|
47 | - public function getUserName($dn); |
|
40 | + /** |
|
41 | + * Translate a LDAP DN to an internal user name. |
|
42 | + * @param string $dn LDAP DN |
|
43 | + * @return string with the internal user name |
|
44 | + * @throws \Exception if translation was unsuccessful |
|
45 | + * @since 11.0.0 |
|
46 | + */ |
|
47 | + public function getUserName($dn); |
|
48 | 48 | |
49 | - /** |
|
50 | - * Convert a stored DN so it can be used as base parameter for LDAP queries. |
|
51 | - * @param string $dn the DN |
|
52 | - * @return string |
|
53 | - * @since 11.0.0 |
|
54 | - */ |
|
55 | - public function DNasBaseParameter($dn); |
|
49 | + /** |
|
50 | + * Convert a stored DN so it can be used as base parameter for LDAP queries. |
|
51 | + * @param string $dn the DN |
|
52 | + * @return string |
|
53 | + * @since 11.0.0 |
|
54 | + */ |
|
55 | + public function DNasBaseParameter($dn); |
|
56 | 56 | |
57 | - /** |
|
58 | - * Sanitize a DN received from the LDAP server. |
|
59 | - * @param array $dn the DN in question |
|
60 | - * @return array the sanitized DN |
|
61 | - * @since 11.0.0 |
|
62 | - */ |
|
63 | - public function sanitizeDN($dn); |
|
57 | + /** |
|
58 | + * Sanitize a DN received from the LDAP server. |
|
59 | + * @param array $dn the DN in question |
|
60 | + * @return array the sanitized DN |
|
61 | + * @since 11.0.0 |
|
62 | + */ |
|
63 | + public function sanitizeDN($dn); |
|
64 | 64 | |
65 | - /** |
|
66 | - * Return a new LDAP connection resource for the specified user. |
|
67 | - * @param string $uid user id |
|
68 | - * @return resource of the LDAP connection |
|
69 | - * @since 11.0.0 |
|
70 | - */ |
|
71 | - public function getLDAPConnection($uid); |
|
65 | + /** |
|
66 | + * Return a new LDAP connection resource for the specified user. |
|
67 | + * @param string $uid user id |
|
68 | + * @return resource of the LDAP connection |
|
69 | + * @since 11.0.0 |
|
70 | + */ |
|
71 | + public function getLDAPConnection($uid); |
|
72 | 72 | |
73 | - /** |
|
74 | - * Get the LDAP base for users. |
|
75 | - * @param string $uid user id |
|
76 | - * @return string the base for users |
|
77 | - * @throws \Exception if user id was not found in LDAP |
|
78 | - * @since 11.0.0 |
|
79 | - */ |
|
80 | - public function getLDAPBaseUsers($uid); |
|
73 | + /** |
|
74 | + * Get the LDAP base for users. |
|
75 | + * @param string $uid user id |
|
76 | + * @return string the base for users |
|
77 | + * @throws \Exception if user id was not found in LDAP |
|
78 | + * @since 11.0.0 |
|
79 | + */ |
|
80 | + public function getLDAPBaseUsers($uid); |
|
81 | 81 | |
82 | - /** |
|
83 | - * Get the LDAP base for groups. |
|
84 | - * @param string $uid user id |
|
85 | - * @return string the base for groups |
|
86 | - * @throws \Exception if user id was not found in LDAP |
|
87 | - * @since 11.0.0 |
|
88 | - */ |
|
89 | - public function getLDAPBaseGroups($uid); |
|
82 | + /** |
|
83 | + * Get the LDAP base for groups. |
|
84 | + * @param string $uid user id |
|
85 | + * @return string the base for groups |
|
86 | + * @throws \Exception if user id was not found in LDAP |
|
87 | + * @since 11.0.0 |
|
88 | + */ |
|
89 | + public function getLDAPBaseGroups($uid); |
|
90 | 90 | |
91 | - /** |
|
92 | - * Check whether a LDAP DN exists |
|
93 | - * @param string $dn LDAP DN |
|
94 | - * @return bool whether the DN exists |
|
95 | - * @since 11.0.0 |
|
96 | - */ |
|
97 | - public function dnExists($dn); |
|
91 | + /** |
|
92 | + * Check whether a LDAP DN exists |
|
93 | + * @param string $dn LDAP DN |
|
94 | + * @return bool whether the DN exists |
|
95 | + * @since 11.0.0 |
|
96 | + */ |
|
97 | + public function dnExists($dn); |
|
98 | 98 | |
99 | - /** |
|
100 | - * Clear the cache if a cache is used, otherwise do nothing. |
|
101 | - * @param string $uid user id |
|
102 | - * @since 11.0.0 |
|
103 | - */ |
|
104 | - public function clearCache($uid); |
|
99 | + /** |
|
100 | + * Clear the cache if a cache is used, otherwise do nothing. |
|
101 | + * @param string $uid user id |
|
102 | + * @since 11.0.0 |
|
103 | + */ |
|
104 | + public function clearCache($uid); |
|
105 | 105 | } |
@@ -35,19 +35,19 @@ |
||
35 | 35 | */ |
36 | 36 | interface ILDAPProviderFactory { |
37 | 37 | |
38 | - /** |
|
39 | - * Constructor for the LDAP provider factory |
|
40 | - * |
|
41 | - * @param IServerContainer $serverContainer server container |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function __construct(IServerContainer $serverContainer); |
|
38 | + /** |
|
39 | + * Constructor for the LDAP provider factory |
|
40 | + * |
|
41 | + * @param IServerContainer $serverContainer server container |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function __construct(IServerContainer $serverContainer); |
|
45 | 45 | |
46 | - /** |
|
47 | - * creates and returns an instance of the ILDAPProvider |
|
48 | - * |
|
49 | - * @return ILDAPProvider |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getLDAPProvider(); |
|
46 | + /** |
|
47 | + * creates and returns an instance of the ILDAPProvider |
|
48 | + * |
|
49 | + * @return ILDAPProvider |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getLDAPProvider(); |
|
53 | 53 | } |
@@ -29,17 +29,17 @@ |
||
29 | 29 | * @since 11.0.0 |
30 | 30 | */ |
31 | 31 | interface IDeletionFlagSupport { |
32 | - /** |
|
33 | - * Flag record for deletion. |
|
34 | - * @param string $uid user id |
|
35 | - * @since 11.0.0 |
|
36 | - */ |
|
37 | - public function flagRecord($uid); |
|
32 | + /** |
|
33 | + * Flag record for deletion. |
|
34 | + * @param string $uid user id |
|
35 | + * @since 11.0.0 |
|
36 | + */ |
|
37 | + public function flagRecord($uid); |
|
38 | 38 | |
39 | - /** |
|
40 | - * Unflag record for deletion. |
|
41 | - * @param string $uid user id |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function unflagRecord($uid); |
|
39 | + /** |
|
40 | + * Unflag record for deletion. |
|
41 | + * @param string $uid user id |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function unflagRecord($uid); |
|
45 | 45 | } |
@@ -39,46 +39,46 @@ |
||
39 | 39 | */ |
40 | 40 | interface ICache { |
41 | 41 | |
42 | - /** |
|
43 | - * Get a value from the user cache |
|
44 | - * @param string $key |
|
45 | - * @return mixed |
|
46 | - * @since 6.0.0 |
|
47 | - */ |
|
48 | - public function get($key); |
|
42 | + /** |
|
43 | + * Get a value from the user cache |
|
44 | + * @param string $key |
|
45 | + * @return mixed |
|
46 | + * @since 6.0.0 |
|
47 | + */ |
|
48 | + public function get($key); |
|
49 | 49 | |
50 | - /** |
|
51 | - * Set a value in the user cache |
|
52 | - * @param string $key |
|
53 | - * @param mixed $value |
|
54 | - * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 |
|
55 | - * @return bool |
|
56 | - * @since 6.0.0 |
|
57 | - */ |
|
58 | - public function set($key, $value, $ttl = 0); |
|
50 | + /** |
|
51 | + * Set a value in the user cache |
|
52 | + * @param string $key |
|
53 | + * @param mixed $value |
|
54 | + * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 |
|
55 | + * @return bool |
|
56 | + * @since 6.0.0 |
|
57 | + */ |
|
58 | + public function set($key, $value, $ttl = 0); |
|
59 | 59 | |
60 | - /** |
|
61 | - * Check if a value is set in the user cache |
|
62 | - * @param string $key |
|
63 | - * @return bool |
|
64 | - * @since 6.0.0 |
|
65 | - * @deprecated 9.1.0 Directly read from GET to prevent race conditions |
|
66 | - */ |
|
67 | - public function hasKey($key); |
|
60 | + /** |
|
61 | + * Check if a value is set in the user cache |
|
62 | + * @param string $key |
|
63 | + * @return bool |
|
64 | + * @since 6.0.0 |
|
65 | + * @deprecated 9.1.0 Directly read from GET to prevent race conditions |
|
66 | + */ |
|
67 | + public function hasKey($key); |
|
68 | 68 | |
69 | - /** |
|
70 | - * Remove an item from the user cache |
|
71 | - * @param string $key |
|
72 | - * @return bool |
|
73 | - * @since 6.0.0 |
|
74 | - */ |
|
75 | - public function remove($key); |
|
69 | + /** |
|
70 | + * Remove an item from the user cache |
|
71 | + * @param string $key |
|
72 | + * @return bool |
|
73 | + * @since 6.0.0 |
|
74 | + */ |
|
75 | + public function remove($key); |
|
76 | 76 | |
77 | - /** |
|
78 | - * Clear the user cache of all entries starting with a prefix |
|
79 | - * @param string $prefix (optional) |
|
80 | - * @return bool |
|
81 | - * @since 6.0.0 |
|
82 | - */ |
|
83 | - public function clear($prefix = ''); |
|
77 | + /** |
|
78 | + * Clear the user cache of all entries starting with a prefix |
|
79 | + * @param string $prefix (optional) |
|
80 | + * @return bool |
|
81 | + * @since 6.0.0 |
|
82 | + */ |
|
83 | + public function clear($prefix = ''); |
|
84 | 84 | } |
@@ -27,12 +27,12 @@ |
||
27 | 27 | * @since 8.2.0 |
28 | 28 | */ |
29 | 29 | class AutoloadNotAllowedException extends \DomainException { |
30 | - /** |
|
31 | - * @param string $path |
|
32 | - * @since 8.2.0 |
|
33 | - */ |
|
34 | - public function __construct($path) { |
|
35 | - parent::__construct('Autoload path not allowed: '.$path); |
|
36 | - } |
|
30 | + /** |
|
31 | + * @param string $path |
|
32 | + * @since 8.2.0 |
|
33 | + */ |
|
34 | + public function __construct($path) { |
|
35 | + parent::__construct('Autoload path not allowed: '.$path); |
|
36 | + } |
|
37 | 37 | } |
38 | 38 |