#8036 closed enhancement (fixed)
allow IPermissionRequestor to extend existing meta-permissions
| Reported by: | Owned by: | Remy Blank | |
|---|---|---|---|
| Priority: | high | Milestone: | 1.0 |
| Component: | general | Version: | 0.11.2.1 |
| Severity: | normal | Keywords: | patch permission |
| Cc: | felix.schwarz@…, leho@… | Branch: | |
| Release Notes: |
Plugins can now extend meta-permissions |
||
| API Changes: |
perm: Made meta-permissions cumulative, so e.g. |
||
| Internal Changes: | |||
Description (last modified by )
Sometimes you might want to introduce a new kind of ticket permission, and add it to TICKET_ADMIN without having to wholly redefine it. A good illustration comes from a test IPermissionRequestor I have defined:
def get_permission_actions(self): return ['TEST_CREATE', 'TEST_DELETE', 'TEST_MODIFY', ('TEST_CREATE', []), ('TEST_ADMIN', ['TEST_CREATE', 'TEST_DELETE']), ('TEST_ADMIN', ['TEST_MODIFY'])]
Except with the imagination that TEST_CREATE actually has something, and the TEST_ADMIN variants are in separate IPermissionRequestors.
Attachments (3)
Change History (18)
by , 17 years ago
| Attachment: | perm-action-alias-extension.diff added |
|---|
comment:1 by , 17 years ago
| Keywords: | patch added |
|---|
The attached patch documents the extension to get_permission_actions's capabilities, tweaks get_actions and expand_actions, mostly rewrites TicketSystem.get_user_permissions, and a test support code change (shown in description) that causes test_meta_permissions to fail if the remainder of the patch is not present.
comment:2 by , 17 years ago
Apologies, I forgot to remove the --lines from the diff. Here is the corrected example:
def get_permission_actions(self): return ['TEST_CREATE', 'TEST_DELETE', 'TEST_MODIFY', ('TEST_CREATE', []), ('TEST_ADMIN', ['TEST_CREATE', 'TEST_DELETE']), ('TEST_ADMIN', ['TEST_MODIFY'])]
comment:3 by , 17 years ago
| Milestone: | → 0.13 |
|---|
comment:4 by , 17 years ago
| Keywords: | permission added |
|---|
follow-up: 10 comment:6 by , 15 years ago
| Cc: | added |
|---|
what's necessary to get this patch in? I'd like to see this fixed. Is it just a code review that's missing?
comment:7 by , 15 years ago
| Milestone: | next-major-0.1X → 0.13 |
|---|---|
| Priority: | normal → high |
A gentle push, as you just did :)
comment:8 by , 15 years ago
| Description: | modified (diff) |
|---|
by , 15 years ago
| Attachment: | 8036-perm-extension-r10316.patch added |
|---|
Updated patch, refactors parts of PermissionSystem.
comment:9 by , 15 years ago
The initial patch didn't apply cleanly anymore, so I had to dig deeper into PermissionSystem. It turns out that it could be cleaned up quite a bit (mostly by removing duplication).
8036-perm-extension-r10316.patch implements the requested functionality and passes all tests. As the permission subsystem is quite critical, it would be great if I could get some review and testing, especially from someone using authz_policy.
by , 15 years ago
| Attachment: | 8036-perm-extension-r10380.patch added |
|---|
Updated patch for current trunk.
comment:10 by , 15 years ago
Replying to fschwarz:
what's necessary to get this patch in? I'd like to see this fixed. Is it just a code review that's missing?
Yes, the code review is all that's missing (hint, hint :)
comment:11 by , 15 years ago
| API Changes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
Patch applied in [10417].
follow-up: 13 comment:12 by , 15 years ago
Sorry for the lack of review, I looked at it and found the change was looking good, but I didn't test nor tried to go deeper. One suggestion I should have made is that having both get_actions() and _get_actions() methods is not optimal, especially given the latter is also documented which suggests it should also be part of the public API. Maybe rename it to get_actions_dict()?
comment:13 by , 15 years ago
Replying to cboos:
One suggestion I should have made is that having both
get_actions()and_get_actions()methods is not optimal, especially given the latter is also documented which suggests it should also be part of the public API. Maybe rename it toget_actions_dict()?
Yes, I wasn't happy with that name either, but I'm notoriously bad at finding good names :) get_actions_dict() sounds good, changed in [10418].
comment:14 by , 15 years ago
| Cc: | added |
|---|
comment:15 by , 13 years ago
| Release Notes: | modified (diff) |
|---|



patch with unit testing