[Radiant] only_allow_access_to declaration is not inherited in controller subclasses

2011-06-26 Thread swartz
Using Radiant 0.9.1, Ruby 1.8.7, Apache + mod_passenger in development
environment (for now).

I'm writing a simple extension, where I have a base controller class
that goes like this:

class Admin::BaseController  ApplicationController
  # allow only admins to the actions in this controller
 
only_allow_access_to :index, :show, :new, :create, :edit, :update, :remove, 
:destroy,
:when = :admin,
:denied_url = { :controller = '/admin/pages', :action =
'index' },
:denied_message = 'You must have administrative privileges to
perform this action.'

  # using inherited resources
  inherit_resources

  # common controller code
  ...
end

And a bunch of controllers that manage contacts, etc.

class Admin::ContactsController  Admin::BaseController
end

But when a non-admin attempts to access this controller  access is
granted but shouldn't be. It appears that only_allow_access_to method
call does not get inherited into Admin::ContactsController or any
other controller that inherits from Admin::BaseController . Why? What
am I missing?

I can copy/paste the call to only_allow_access_to for each controller,
but it seems not very DRY.

Having Googled this issue, I found no explanation and ran into a
single msg in this group but no replies.

Would anyone be able to explain why call to only_allow_access_to isn't
being inherited?

Thanks!





[Radiant] Error installing rc2

2011-06-26 Thread Horst Rischbode

Hi,

I'm on Ubuntu with Ruby 1.9.2 and installed Radiant 1.0 rc2 without 
errors. Installation of a new instance succeeds as well.


If I do

rake development/production db:bootstrap

the migrations seem to work (no error messages at console or in log) but 
the behaviour of template selection is strange:


Select a database template:
[1-0]: 1
You must choose one of []

I use sqlite3. The database files are generated and seem to contain all 
the tables. Can anyone point me in the right direction?


Horst



[Radiant] Re: Multiple Server Deployment for Radiant

2011-06-26 Thread Shanison
Hi William,

Thank you very much for your detailed explanation and suggestion. This
is very helpful. For my case, actually it is for railover, so I think
I have to use rSync or write an extension that money patch the asset
manager, where upon any files uploaded to the server, I can do a
synchronization.

This is a bit trouble though. We have also thought of storing all
assets in the db instead. Synchronization of db is much easier and
efficient. But this means that we have to money patch the asset
manager again to make it store in db instead of file system.

Thanks,
Shanison

On Jun 20, 3:14 am, William Ross w...@spanner.org wrote:
 On 19 Jun 2011, at 16:54,Shanisonwrote:

  Hi all,

  I have one Radiant website but deployed to a few servers, and one of
  the server S1 will be used to serve static file content and serve as a
  reverse proxy and redirect dynamic page request back to the other
  servers S2, S3, S4. So my question is that when admin login to the
  admin page, it can be from any of the servers, S2 or S3, S4. If he
  uploads files e.g. images to S2, how can the rest of servers serves
  the files? If a request comes in to display a page and is served at
  S3, that images used in the page won't be displayed as it is not in
  the same server.

  Is there a way to synchronize it? Thank you.

 I've done this different ways in the past and the I think the right one would 
 depend on your reason for spreading across several servers in the first place:

 * If it's for load-sharing, and you can think of one of the servers as the 
 master, you may find it's enough just to redirect all requests for /admin and 
 /assets to the master.

 * if it's for redundancy and failover, you will need some scripting behind 
 radiant to move files around. Again, the method depends on your situation: 
 you can do it with rsync or an active push from the receiving server. It 
 would be easy to write an extension that triggered the mirroring script upon 
 image update, but note that you'd have to duplicate all the thumbnail sizes 
 as well as the original image.

 * If it's geographical, or the other two solutions don't appeal, you could 
 just use a CDN with uplift, or the built-in S3 support we get from paperclip.

 I think the most successful strategy I've used was to set up both database 
 servers (this was a rather paranoid and very busy site) as simple static-file 
 asset servers, and to direct all requests for static files from those two. 
 There were some rather basic rsync scripts to mirror uploaded assets. I 
 figured that if the database went down then the rest didn't really matter 
 anyway.

 If anyone knows a standard (cross-platform) way that we could meet this 
 requirement from within radiant's asset manager I'd be very happy to write it 
 in.

 For what it's worth, I don't deploy across multiple servers any more, apart 
 from a separate database host. More recently I've found that one decent 
 server with a long cache life is more efficient than several with only brief 
 caches (as they must be, because you're only ever clearing the cache on one 
 of them).

 best,

 will