dchun / QuoteManager

Saas App for Managing Quotes and getting paid
https://quotemanager.boopis.com
0 stars 0 forks source link

Store Files Under Account ID #107

Closed dchun closed 9 years ago

dchun commented 9 years ago

Currently files are stored in a tmp subfolder that is labeled as the field id in the json object.

Can we add all files under the account ID and add it to a subfolder organized by a two digit year suffix concatenated with a two digit month?

So If I am a user and I am under the account.id = 1 and I upload a file image.png,

It should be uploaded to the directory "uploads/files/1/15-06/image.png"

dchun commented 9 years ago

Also can we make sure that the files are only accessible to logged in users where the files are scoped to the user?

And can we also allow the user to download the file in the requests#show view?

phuong3030 commented 9 years ago

This issue makes me dive into 'egg and chicken' problem. I just create asset model, and one account can have many assets. To connect asset with request, i stored request id in asset. But to access asset, i must store url form asset to request field. =))

It seems ok now. https://github.com/boopis/QuoteManager/pull/112 request view request index

dchun commented 9 years ago

Check out the possibility of changing permissions and adding allowances in the controller: https://github.com/carrierwaveuploader/carrierwave/wiki/how-to:-secure-upload

phuong3030 commented 9 years ago

https://github.com/boopis/QuoteManager/pull/113 Store file in secure folder and download routes.