Opened 15 years ago

Last modified 13 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
Pull Requests:How to create a pull request

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.

According to the ticket's flags, the next step(s) to move this issue forward are:

  • To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is: [https://github.com/django/django/pull/#### PR].

Change History (9)

comment:1 by Russell Keith-Magee, 15 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, 14 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, 14 years ago

Type: New feature

comment:4 by Luke Plant, 14 years ago

Severity: Normal

comment:5 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:6 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:7 by Joey Wilhelm, 13 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, 13 years ago

Cc: tarkatronic@… added

by Joey Wilhelm, 13 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