[PLUGIN][AttachmentCollections] Prevent user from appending stuff in a collection (s)he doesn't own
This commit is contained in:
parent
1e965157de
commit
af3d278fde
@ -153,12 +153,16 @@ class AttachmentCollections extends Plugin
|
||||
['aid' => $attachment_id, 'id' => $user->getId(), 'ids' => $removed]
|
||||
);
|
||||
}
|
||||
$collection_ids = \array_map(fn ($x) => $x->getId(), $colls);
|
||||
foreach ($added as $cid) {
|
||||
// prevent user from putting something in a collection (s)he doesn't own:
|
||||
if (\in_array($cid, $collection_ids)) {
|
||||
DB::persist(CollectionEntry::create([
|
||||
'attachment_id' => $attachment_id,
|
||||
'collection_id' => $cid,
|
||||
]));
|
||||
}
|
||||
}
|
||||
DB::flush();
|
||||
}
|
||||
// add to new collection form
|
||||
|
Loading…
Reference in New Issue
Block a user