10
10
use OC \Files \Storage \Wrapper \Wrapper ;
11
11
use OCA \Files_Trashbin \Events \MoveToTrashEvent ;
12
12
use OCA \Files_Trashbin \Trash \ITrashManager ;
13
+ use OCP \App \IAppManager ;
13
14
use OCP \Encryption \Exceptions \GenericEncryptionException ;
14
15
use OCP \EventDispatcher \IEventDispatcher ;
15
16
use OCP \Files \IRootFolder ;
16
17
use OCP \Files \Node ;
17
18
use OCP \Files \Storage \IStorage ;
19
+ use OCP \IRequest ;
18
20
use OCP \IUserManager ;
21
+ use OCP \Server ;
19
22
use Psr \Log \LoggerInterface ;
20
23
21
24
class Storage extends Wrapper {
@@ -159,18 +162,7 @@ private function doDelete($path, $method) {
159
162
return call_user_func ([$ this ->storage , $ method ], $ path );
160
163
}
161
164
162
- // check permissions before we continue, this is especially important for
163
- // shared files
164
- if (!$ this ->isDeletable ($ path )) {
165
- return false ;
166
- }
167
-
168
- $ isMovedToTrash = $ this ->trashManager ->moveToTrash ($ this , $ path );
169
- if (!$ isMovedToTrash ) {
170
- return call_user_func ([$ this ->storage , $ method ], $ path );
171
- } else {
172
- return true ;
173
- }
165
+ return call_user_func ([$ this ->storage , $ method ], $ path );
174
166
}
175
167
176
168
/**
@@ -182,16 +174,18 @@ public static function setupStorage() {
182
174
$ logger = \OC ::$ server ->get (LoggerInterface::class);
183
175
$ eventDispatcher = \OC ::$ server ->get (IEventDispatcher::class);
184
176
$ rootFolder = \OC ::$ server ->get (IRootFolder::class);
177
+ $ request = \OC ::$ server ->get (IRequest::class);
185
178
Filesystem::addStorageWrapper (
186
179
'oc_trashbin ' ,
187
- function (string $ mountPoint , IStorage $ storage ) use ($ trashManager , $ userManager , $ logger , $ eventDispatcher , $ rootFolder ) {
180
+ function (string $ mountPoint , IStorage $ storage ) use ($ trashManager , $ userManager , $ logger , $ eventDispatcher , $ rootFolder, $ request ) {
188
181
return new Storage (
189
182
['storage ' => $ storage , 'mountPoint ' => $ mountPoint ],
190
183
$ trashManager ,
191
184
$ userManager ,
192
185
$ logger ,
193
186
$ eventDispatcher ,
194
187
$ rootFolder ,
188
+ $ request ,
195
189
);
196
190
},
197
191
1 );
0 commit comments