Authorization and DragonFly

100 views
Skip to first unread message

Bruno Almeida

unread,
Oct 18, 2011, 1:45:58 PM10/18/11
to Dragonfly
hi,

I need to authorize users to access my files.

How to do this with DragonFly and Refinery CMS?

Thanks,
Bruno

Stefan Wintermeyer

unread,
Oct 22, 2011, 3:51:32 AM10/22/11
to Dragonfly
On Oct 18, 7:45 pm, Bruno Almeida <brunomonteiroalme...@gmail.com>
wrote:
> I need to authorize users to access my files.
>
> How to do this with DragonFly and Refinery CMS?

I have the same problem. I use cancan for authorization but can't
control who can access the files. "Secret" pathnames are not an
option.

Is this solvable with DragonFly? I did it in the past with
attachment_fu but I'd like to use a more up to date tool.

Stefan

Stefan Wintermeyer

unread,
Oct 22, 2011, 4:04:05 AM10/22/11
to Dragonfly
On Oct 22, 9:51 am, Stefan Wintermeyer <stefan.winterme...@amooma.de>
wrote:
> > I need to authorize users to access my files.
>
> > How to do this with DragonFly and Refinery CMS?
>
> I have the same problem. I use cancan for authorization but can't
> control who can access the files. "Secret" pathnames are not an
> option.
>
> Is this solvable with DragonFly? I did it in the past with
> attachment_fu but I'd like to use a more up to date tool.

To answer my own question:
http://www.therailsway.com/2009/2/22/file-downloads-done-right

I haven't tested it yet but it looks like a feasible way.

Stefan

Bruno Almeida

unread,
Oct 23, 2011, 6:31:03 PM10/23/11
to Dragonfly
Hi,

I knew a solution, on paperclip way:
http://everydayrails.com/2010/07/08/authenticated-attachments-paperclip-rails.html

But, on dragonfly i cannot do this. I can't understand why. i supose
the cache mecanism is the problem.

I hope you understand my crapy english :)

Thanks, Bruno



On Oct 22, 9:04 am, Stefan Wintermeyer <stefan.winterme...@amooma.de>

Mark Evans

unread,
Oct 24, 2011, 10:47:13 AM10/24/11
to Dragonfly
I haven't done much in the way of authorization on a per-asset basis,
but just to remind you in case it helps:

- you can override Dragonfly responses with before_serve
http://markevans.github.com/dragonfly/file.URLs.html#Overriding_responses
e.g.

app.configure do |c|
c.server.before_serve do |job, env|
# inspect env for correct auth and set unauthorized
# ....
if unauthorized
throw :halt, [401, {'Content-type' => 'text/plain'},
['unauthorized']]
end
end
end

- also, the dragonfly server is just Rack, so you could add some
custom Rack middleware in front of it for authorization


On Oct 23, 11:31 pm, Bruno Almeida <brunomonteiroalme...@gmail.com>
wrote:
> Hi,
>
> I knew a solution, on paperclip way:http://everydayrails.com/2010/07/08/authenticated-attachments-papercl...
Reply all
Reply to author
Forward
0 new messages