Opened 16 years ago
Closed 16 years ago
#10649 closed (duplicate)
Permission to anonymous
Reported by: | niarium | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Granting a permission to anonymous is needed.
The situation goes like this. You have a forum application, and, in the forum model, you have some ForeignKey
s (to permission) that will correspond to the actions you can take in a forum, like reading writing listing and commenting. Some forums are supposed to be read and written by anonymous users. However, no matter what permission I assign for the reading action, the method request.user.has_perm
always returns false if the user is not logged in.
There are workarounds, one of them being that you give null=true
and blank=true
to those ForeignKey
s and check whether they are None
or not before calling has_perm
. But then you need an extra line of code and will lose the consistency, treating anonymous permissions very specially.
Trac (which the django project itself uses for development too) has permission to anonymous, making it easier to set actions to be taken by anonymous. It will be great for django to have that too.
Duplicate of #9444.