8.4.2: search_file_folder permissions don't work on user
Permalinkand this in the block form:
<?php if ($permissions) { ?> ... <?php } else { ?> <fieldset class="ab-file-list-form"> <div class="form-group"> <div class="alert alert-danger" role="alert"> <?php echo t('You do not have permissions to search files'); ?> </div> </div> </fieldset> <?php } ?>
What happens is when I add the block as the original admin, it works fine. But when I add the block as 'user1', it says 'You do not have permissions to search files', that is the 'search_file_folder' is not set for that user.
What's wrong here?
Thank you.

So if you know the group:
use Concrete\Core\Permission\Key\FileFolderKey; $group = Group::getByID($group_id); // or // $group = Group::getByName('My Group'); if ($group) { $file_system = $this->app->make(Filesystem::class); $root_folder = $file_system->getRootFolder(); $folder = FileFolder::getNodeByName('My Folder'); if ($folder && $folder instanceof FileFolder) { $pk = FileFolderKey::getByHandle('search_file_folder'); $pk->setPermissionObject($folder); $pt = $pk->getPermissionAssignmentObject(); if ($pt) { $pt->clearPermissionAssignment(); $pa = $pk->getPermissionAccessObject();
Note the above is adapted from another piece of code for a different permission key, I have not tried that. See the /concrete/src/File/FolderItemList.php