Forum: Radiant CMS Best way to protect pages with custom auth-system?

58ce6437f17a1ca96049500cf66ece6f?d=identicon&s=25 swartz (Guest)
on 2010-10-16 21:09
(Received via mailing list)
I have a custom auth-system based on authlogic (based largely on
reader extension).
I have two roles: regular users and moderators.
I also have two extra pages types, one is for moderators only, the
other is for either.

Whats would be recommended way to require certain user role to access
a particular page type?
Should I define a custom process() method for each page or is there a
better way?
09477c358c5897d44121a248326e16d7?d=identicon&s=25 Jim Gay (Guest)
on 2010-10-29 05:36
(Received via mailing list)
On Sat, Oct 16, 2010 at 3:08 PM, swartz <netvent@gmail.com> wrote:
>
I haven't tried this myself.
You could create a custom process, you could perhaps create a rack
session and use http://github.com/hassox/warden/wiki/Setup
0964828011133c856bae646e55911115?d=identicon&s=25 William Ross (spanner)
on 2010-10-29 10:23
(Received via mailing list)
On 29 Oct 2010, at 04:35, Jim Gay wrote:

>> better way?
reader_group does something similar by overriding find_page and
show_page in site_controller, but I looking at it now I probably should
just have chained Page#find_by_url and defined some new exception types
for the controller to catch.

best,

will
58ce6437f17a1ca96049500cf66ece6f?d=identicon&s=25 swartz (Guest)
on 2010-11-01 22:53
(Received via mailing list)
What I've done so far is to use around_filter with process_page from
SiteController.
But I find that the login in this overwritten method is expensive as
it has to run and hit the database for every page.
Just seeing if there're better ways to do this.
58ce6437f17a1ca96049500cf66ece6f?d=identicon&s=25 swartz (Guest)
on 2010-11-01 22:57
(Received via mailing list)
I'm toying with the idea of caching the permissions, that is load them
all up and their permission from table into memory and keep them
there.
So it doesn't have to hit the database every time.
The good thing is there're only 200 pages and not 2,000.
This topic is locked and can not be replied to.