Respect access to own media only when searching media
authorMatthias Schmidt <gravatronics@live.com>
Sat, 22 Feb 2020 15:54:47 +0000 (16:54 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 22 Feb 2020 15:54:47 +0000 (16:54 +0100)
wcfsetup/install/files/lib/data/media/MediaAction.class.php

index 7cc233e20b1b35df626aa0bfceccdb4c4c31bc84..a604afa13068812fe3fb3f7ad0fa0447b1717841 100644 (file)
@@ -494,6 +494,9 @@ class MediaAction extends AbstractDatabaseObjectAction implements ISearchAction,
        public function getSearchResultList() {
                $mediaList = new MediaList();
                $mediaList->addSearchConditions($this->parameters['searchString']);
+               if (WCF::getSession()->getPermission('admin.content.cms.canOnlyAccessOwnMedia')) {
+                       $mediaList->getConditionBuilder()->add('media.userID = ?', [WCF::getUser()->userID]);
+               }
                if ($this->parameters['imagesOnly']) {
                        $mediaList->getConditionBuilder()->add('media.isImage = ?', [1]);
                }