Skip to content

solrfal indexing and fe-groups restriction not working #161

Description

@baschny

It seems that under certain circumstances files indexed with solrfal do not get the correct access restrictions set.

I had configured like documented:

plugin.tx_solr.index.queue._FILES.default {
    # Make sure the fe_groups from fal_securedownload are considered
    access = TEXT
    access {
        value = r:0
        override {
            cObject = TEXT
            cObject {
                required = 1
                field = fe_groups
                wrap = r:|
            }
        }
    }
}

Imagine that I have set the permissions using the "File" backend module like this:

+--------------------------+-----------+
| folder                   | fe_groups |
+--------------------------+-----------+
| /                        |           |
| /Downloads/              | 32        |
| /Downloads/Subfolder/    | 84        |
+--------------------------+-----------+

Any file under "Downloads/Subfolder" is wrongly indexed with r:0 and it appears in all search results (instead of only if the user has access to group 84).

When indexing, this method is called \BeechIt\FalSecuredownload\Security\CheckPermissions::getPermissions by fileMetaDataRetrieved. It will return "empty" (instead of 84) for these files because its logic seems broken.

It goes from the root folder up to the folder where the file resides, but aborts after finding any "folderRecord":

        $feGroups = [];
        // loop trough the root line of an folder and check the permissions of every folder
        foreach ($this->getFolderRootLine($resource->getParentFolder()) as $folder) {
            // fetch folder permissions record
            $folderRecord = $this->utilityService->getFolderRecord($folder);

            // if record found check permissions
            if ($folderRecord) {
                if ($feGroups === []) {
                    $feGroups = GeneralUtility::trimExplode(',', $folderRecord['fe_groups'], true);
                }
                if ($folderRecord['fe_groups']) {
                    $feGroups = ArrayUtility::keepItemsInArray($feGroups, $folderRecord['fe_groups']);
                }
                break;
            }
        }

One quick'n'dirty solution is currently to only have "folderRecords" on the leafs where the files resides.

Can anybody confirm this is a bug and maybe we can brainstorm about a solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions