File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -197,13 +197,20 @@ public function removeItem(ITrashItem $item) {
197
197
if ($ node === null ) {
198
198
throw new NotFoundException ();
199
199
}
200
- if ($ node ->getStorage ()->unlink ($ node ->getInternalPath ()) === false ) {
201
- throw new \Exception ('Failed to remove item from trashbin ' );
202
- }
200
+
203
201
if (!$ this ->userHasAccessToPath ($ item ->getUser (), $ item ->getPath (), Constants::PERMISSION_DELETE )) {
204
202
throw new NotPermittedException ();
205
203
}
206
204
205
+ $ folderPermissions = $ this ->folderManager ->getFolderPermissionsForUser ($ item ->getUser (), (int )$ folderId );
206
+ if (($ folderPermissions & Constants::PERMISSION_DELETE ) !== Constants::PERMISSION_DELETE ) {
207
+ throw new NotPermittedException ();
208
+ }
209
+
210
+ if ($ node ->getStorage ()->unlink ($ node ->getInternalPath ()) === false ) {
211
+ throw new \Exception ('Failed to remove item from trashbin ' );
212
+ }
213
+
207
214
$ node ->getStorage ()->getCache ()->remove ($ node ->getInternalPath ());
208
215
if ($ item ->isRootItem ()) {
209
216
$ this ->trashManager ->removeItem ((int )$ folderId , $ item ->getName (), $ item ->getDeletedTime ());
You can’t perform that action at this time.
0 commit comments