[TYPO3-dev] FAL and EnableFields - suggestion for improvement

André Spindler typo3 at andre-spindler.de
Sat May 30 23:22:26 CEST 2015


Hi Frans,

thank you for your response.
But as far as I have seen in the source code of your extension you just 
do the same as I do for checking the access right:
You fetch all files from FAL and then AFTERWARDS check for matching 
access rights. Is that right?

Therefore FAL creates objects for files and folders you will skip later. 
for me these are wasted ressources, memory and time.
For the moment I do the same in my extension. But what I asked for is a 
solution to make FAL return just the required data. To filter the 
returned objects without the need to create some kind of php code to 
loop through the files just to check access rights.
In your extension you check acceess when rendering the returned entries. 
This way it is possible to find a folder the user has acces to, but is 
it empty as there is no allowed file. But for my case this is not 
enough. As our customer required to not display "empty" objects, we have 
to check the complete data for empty elements - recursive. This means a 
lot of wasted resources in some special cases.

In my opinion it is also better to limit the data what I get from a 
select query when retrieving it than run through the results in a php 
loop and throw wrong results away using additional conditions.

Regards,
André


Am 30.05.2015 um 22:27 schrieb Frans Saris:
> Hi André,
>
> We took a slightly different approach for using the fe_group field to
> secure files in fe.
>
> See http://typo3.org/extensions/repository/view/fal_securedownload and
> https://github.com/beechit/fal_securedownload. It uses the current FAL API
> mostly with some additions to determine if a user has the correct
> permissions when accessing a file.
>
> Gr. Frans
>   Hello,
>
> in a fresh installation of TYPO3 CMS 6.2 there are no enable fields in FAL.
> This makes sense for most use cases.
> But even the system extension filemetadata adds a field fe_groups. But only
> db table and TCA is changed.
> So if use USE this system feature and expect it is already included, you
> get wrong.
>
> Looking into the file repository this gets clear.
> Method \TYPO3\CMS\Core\Resource\FileRepository::findByRelation() calls
> enableFields() for table sys_file_reference, but not for sys_file_metadata.
> Adding this here would mean to add a third table here in the SELECT
> statement and an additional relation to be resolved. Due to performance
> reasons this should be avoided.
> But what about introducing a signal here?
> Just between compiling the SELECT statement and executing it?
> In system extension filemetadata there could be added a slot then to extend
> the query to check the enable fields of the metadata.
>
> At the moment this system feature (fe_groups) is nearly useless. If you
> need to check access restrictions on file level, you have to fetch all
> records by a sql query first. As enableFields just returns the finally
> where clause, you have to build up the list of groups for youself and run
> with php through all entries by checking them. And don't forget to discard
> unneeded entries to reduce memory usage. Perhaps at the and there is no
> single entry at all, but you have executed a lot of php code and used a lot
> of memory...
>
> Regards,
> André Spindler
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev

-- 

_____________________________________________________________________
André Spindler
Schmidstraße 21 - 85399 Hallbergmoos
Telefon: 0811/9986774 - andre at andre-spindler.de




More information about the TYPO3-dev mailing list