Comment 2 for bug 1530611

Revision history for this message
Aaron Wells (u-aaronw) wrote :

It may make sense to just strip down get_artefactchooser_artefacts to be much, much simpler than it currently is. That method has a lot of outdated access control code in it. It looks like it was probably the method at one time used for selecting file artefacts, but they were long ago changed to use the Pieform "filebrowser" element instead, which has a different underlying method for retrieving the eligible artefacts.

Once the file artefacts were refactored away from "filechooser", the remaining blocktypes using it were blog, profile, and resume, none of which were available as group or institution artefacts until we added group & institution blogs in Mahara 15.10. Consequently the group & institution blogs inherited this dusty outdated access control that was originally meant for files.

That being the case, I think the best thing to do is to strip out all the convoluted access stuff in get_artefactchooser_artefacts(), and make it so that it basically matches the access model for blogs. We may even get a performance boost out of that. The other place it gets called is in BlockInstance->rebuild_artefact_list(), which gets called every time a block is updated, to get the list of artefacts "allowed" in that block. If we change it so that *only* the file artefact uses the convoluted version of the query with checks for group file permissions etc, then it may improve the save time for all the other block types.