| View previous topic :: View next topic |
| Author |
Message |
rantaaho
Joined: 09 Jan 2008 Posts: 47 Location: Kuopio, Finland
|
Posted: Mon 11 Feb, 2008 12:27 Post subject: Page permissions |
|
|
Are there any plans for implementing page permissions, i.e. restrict access to page for some users or user groups?
Since Django doesn't support row level permissions, this has to be done in PyLucid. I think that it is not possible to implement permissions without changing Page-model.
I need permissions, and I can do some coding for it. But since it includes more than just writing a plugin, I would like to do it so, that it could be accepted to PyLucid codebase. Thus all suggestions and guidance are very wellcome.
My target is to restrict some of the pages to some user groups. Thus, I was planning to add to the Page-model a ManytoMany-relationship with Django groups. So that if a Page has some related groups, user has to belong at least one of them to see the page. Adding that check to page rendering and main_menu shouldn't be that hard, or? |
|
| Back to top |
|
 |
jens Administrator
Joined: 12 Oct 2005 Posts: 972 Location: duisburg, germany
|
Posted: Mon 11 Feb, 2008 12:39 Post subject: |
|
|
Yes, there exist no real page permissions.
You can edit the bool "PermitViewPublic" in the django panle under the TAB "Advanced options"... So you can limit the access to users how are logged-in.
There exist the Point "PermitViewGroup" and "PermitEditGroup"... But these Values aren't working. Its not complete implemented...
The Problem is: I don't need this features really. So i not work active on this stuff...
If you will implement a page permission systems, it's very welcome But i think this is a Feature for v0.8.1 and not for v0.8, that i will release soon... _________________
http://www.jensdiemer.de | http://www.htfx.de | http://www.python-forum.de
|
|
| Back to top |
|
 |
rantaaho
Joined: 09 Jan 2008 Posts: 47 Location: Kuopio, Finland
|
Posted: Mon 11 Feb, 2008 14:47 Post subject: |
|
|
Ok, I hadn't found PermitViewGroup et al.
I will check what I can do for permissions. |
|
| Back to top |
|
 |
jens Administrator
Joined: 12 Oct 2005 Posts: 972 Location: duisburg, germany
|
|
| Back to top |
|
 |
rantaaho
Joined: 09 Jan 2008 Posts: 47 Location: Kuopio, Finland
|
Posted: Tue 12 Feb, 2008 12:18 Post subject: |
|
|
Thanks for the pointer.
The obvious next questions are: which exception should it raise: AccessDeny, Http404, or should we have a separate Http401?
Where these exceptions are supposed to be handled? There doesn't seem to be code for that in index.py. For 404 and 500 the default seems to be Django. |
|
| Back to top |
|
 |
jens Administrator
Joined: 12 Oct 2005 Posts: 972 Location: duisburg, germany
|
|
| Back to top |
|
 |
rantaaho
Joined: 09 Jan 2008 Posts: 47 Location: Kuopio, Finland
|
Posted: Tue 12 Feb, 2008 14:48 Post subject: |
|
|
From RFC 2616:
| Quote: | 401 Unauthorized
The request requires user authentication. |
| Quote: | 403 Forbidden
The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. |
So clearly 401.
I noticed templates for 404 and 500, but I got confused since they are not used when settings have DEBUG=True... But anyway, we need some other way to deal with permission denied exceptions. |
|
| Back to top |
|
 |
jens Administrator
Joined: 12 Oct 2005 Posts: 972 Location: duisburg, germany
|
|
| Back to top |
|
 |
jens Administrator
Joined: 12 Oct 2005 Posts: 972 Location: duisburg, germany
|
|
| Back to top |
|
 |
rantaaho
Joined: 09 Jan 2008 Posts: 47 Location: Kuopio, Finland
|
Posted: Tue 19 Feb, 2008 09:59 Post subject: Unittests |
|
|
Thanks,
You were faster in fixing one of the FIXMEs.
I will write an unittest for permitViewPublic. But could you describe the unittest system of PyLucid little bit. It doesn't follow the standard Django system. The unittest's are under dev_scripts/unittests, right? Some other test scripts under dev_scripts/local_tests and something under pylucid/tests, what are these?
Is there somewhere a script to run all unittests? Shouldn't it be called pylucid/PyLucid/tests.py so that "django-admin.sh test" would work? |
|
| Back to top |
|
 |
jens Administrator
Joined: 12 Oct 2005 Posts: 972 Location: duisburg, germany
|
|
| Back to top |
|
 |
rantaaho
Joined: 09 Jan 2008 Posts: 47 Location: Kuopio, Finland
|
Posted: Tue 19 Feb, 2008 13:17 Post subject: |
|
|
Ok, thanks.
Now it makes more sense. |
|
| Back to top |
|
 |
jens Administrator
Joined: 12 Oct 2005 Posts: 972 Location: duisburg, germany
|
|
| Back to top |
|
 |
jens Administrator
Joined: 12 Oct 2005 Posts: 972 Location: duisburg, germany
|
|
| Back to top |
|
 |
|