Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#25229 closed Cleanup/optimization (fixed)

Docs for permission_required decorator don't describe behavior for multiple permission arguments

Reported by: Brendan Jurd Owned by: nobody
Component: Documentation Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The docs for permission_required say that you may pass in an iterable of permissions, but don't say anything about what that actually means. Does it require ANY of the listed permissions, or ALL?

To figure this out, the user has to look up the source code for permission_required, see that it calls has_perms(), and then look up the docs for has_perms to see that it requires ALL the listed permissions to be held. Sad trombone.

https://docs.djangoproject.com/en/1.8/topics/auth/default/#the-permission-required-decorator

Attachments (1)

25229.diff (672 bytes ) - added by Tim Graham 9 years ago.

Download all attachments as: .zip

Change History (5)

by Tim Graham, 9 years ago

Attachment: 25229.diff added

comment:1 by Tim Graham, 9 years ago

Has patch: set
Summary: Docs for permission_required decorator doesn't describe behaviour for multiple permission argumentsDocs for permission_required decorator don't describe behavior for multiple permission arguments
Triage Stage: UnreviewedAccepted

Does the attached patch look sufficient?

in reply to:  1 comment:2 by Brendan Jurd, 9 years ago

Replying to timgraham:

Does the attached patch look sufficient?

Yes, that looks great, thanks Tim!

comment:3 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 16a8d01:

Fixed #25229 -- Clarified how an iterable works with @permission_required

comment:4 by Tim Graham <timograham@…>, 9 years ago

In a7fb311:

[1.8.x] Fixed #25229 -- Clarified how an iterable works with @permission_required

Backport of 16a8d01308f8ca4a7b4673424059424ba3fe36c8 from master

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