views:

214

answers:

1

I've installed Django CMS (http://www.django-cms.org/) and it's almost perfect. I've been chatting on the IRC #django-cms group and it's been confirmed to me that I can't have access restricted to the pages I make in Django CMS to only a select few on the site side.

I know of the CMS_PERMISSIONS setting, but this seems to only restrict users on the admin site. What I am trying to achieve is have pages that are made in the admin side of CMS are restricted on the site side to a select few. So on my site side, I'd have my normal pages of Home, About, Services, Contact and then they'll be a login area. Once logged in, they'll be pages that can only be available to particular people. Some of the pages to some users, other pages to other users.

If this can't be achieve in the normal Django CMS installation, how on earth would I achieve this in another way? I'm not a Django expert, but this is something I'd like to do, and I'm not sure where to start. Can anyone help with this? Has anyone else achieved this?

A: 

I don't know Django CMS, but you could do such filtering in middleware - i.e. you could check incoming URL and redirect to login page if current user doesn't have permissions to view it.

http://docs.djangoproject.com/en/1.1/topics/http/middleware/

Tomasz Zielinski
How would I check for this incoming URL? The secured articles will be at domain.com/articles/*... and would I need django-registration app to make this site side authorisation happen?
littlejim84
Middleware.process_request receives request object wchich has the following attribute:http://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.path
Tomasz Zielinski
I see... So I can grab the URL and the User object from the request object. Thank you.
littlejim84