Opened 14 years ago

Last modified 12 years ago

#13127 new New feature

Template tag "perms" doesn't support object level permission checking

Reported by: Dana Spiegel Owned by: nobody
Component: contrib.auth Version: 1.2-beta
Severity: Normal Keywords:
Cc: tarkatronic@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This should be a quick fix, but the perms template tag doesn't allow the specification of an object in order to test for object level permissions.

Attachments (1)

permissions.py (2.1 KB ) - added by Joey Wilhelm 12 years ago.
Missed a debug statement in the previous attachment

Download all attachments as: .zip

Change History (9)

comment:1 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

{{ perms }} isn't a template tag -- it's an object put into the context by the PermWrapper context processor. However, the use case is valid.

comment:2 by aidan, 13 years ago

Is there a workaround for this? From looking at the core context processor's PermWrapper it doesn't look like an easy change.

comment:3 by Luke Plant, 13 years ago

Type: New feature

comment:4 by Luke Plant, 13 years ago

Severity: Normal

comment:5 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:6 by Aymeric Augustin, 12 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:7 by Joey Wilhelm, 12 years ago

I had need to tackle this for a project I am working on; this was one of the final pieces in fully implementing generic row-level permissions, so I figured I would share my results. I couldn't figure out a way to make this work cleanly and easily with the PermWrapper context processor, so I ended up creating a new template tag, {% ifpermitted %}. I will attach the code momentarily. If there is any interest in using this approach, I could work up docs/tests for this tag (or gladly let somebody else do those, as I have zero experience with them)

comment:8 by Joey Wilhelm, 12 years ago

Cc: tarkatronic@… added

by Joey Wilhelm, 12 years ago

Attachment: permissions.py added

Missed a debug statement in the previous attachment

Note: See TracTickets for help on using tickets.
Back to Top