#1 June 25, 2013 12:51pm

asiral
Member
Registered: May 18, 2013
Posts: 43

Deleting Resources/Assets/Images

If I wanted to add the capability for users to delete resources uploaded through the Image Library/File Browser, what would be the suggested approach?  I see in /core/admin/ajax/file-browser, there are a lot of functions but none to delete files.  I also see that entries are created in the database referencing the assets uploaded.  Is there a recommended approach or anything I should be aware of?  What about checking for where the asset is referenced?

Thanks again!
Michael

Offline

#2 June 25, 2013 12:56pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 970

Re: Deleting Resources/Assets/Images

Deleting resources is one of the challenges we hope to breach in the 4.1 release. The biggest issues are definitely:
- Who has the permissions to delete a file? The person that uploaded it? Everyone that's a "Creator" in the folder?
- Should the user be allowed to delete the file if it's being referenced in a Page or Module Entry they don't have the right to publish?
- What do we do with the Pages / Module entries that reference the asset when it's deleted?

As far as checking for where it's referenced, you can probably do a LIKE query on bigtree_pages checking the callouts and resources columns checking for the file name. Checking module content is tricky. You could use all the module classes built in search method but you'd need to loop through bigtree_modules getting all the classes and then instantiating them and calling the method.

I'm not sure what approach we will use when we tackle it, but that's what I can think of off the top of my head.

Offline

#3 September 24, 2013 5:32am

yckart
Member
Registered: September 24, 2013
Posts: 1

Re: Deleting Resources/Assets/Images

I think the best way would be to allow just the "Developer's", "Administrator's" and its "Uploader" to delete the file.

- If a file is referenced somewhere, only "Adminstrator's" & "Developer's" should be able to remove it, until the file is not longer referenced
- - (and if the "Creator" of the Page / Module is also uploader of the asset, the "Creator" too)
- Pages / Modules should keep an eye on the existence of its assets. If they are removed, remove them from their entries

Offline

#4 September 24, 2013 9:18am

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 970

Re: Deleting Resources/Assets/Images

Very good suggestions. I think that makes a lot of sense. We're going to have some internal team meetings and hopefully we'll bounce your suggestions around and see what we all come up with together.

Thanks for your input! Hopefully we can have this tackled soon!

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.