Opened 14 years ago
Last modified 5 years ago
#9526 new defect
Fine Grained Permission possible realms and paths format are not documented.
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | next-major-releases |
Component: | wiki system | Version: | 0.12 |
Severity: | minor | Keywords: | permissions documentation authzpolicy |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
I'm trying to configure authz_policy.py (TracFineGrainedPermissions) for things other than Wiki Pages.
I can see that this is possible and working, but I'm waisting my time discovering "paths and realms" for every single thing I want to manage via authz_policy.
All the samples and documentation I've found describe configuration for wiki: realms *only* and while this is probably most common usage I'd like to create a ticket to expand the documentation in this topic.
Attachments (0)
Change History (11)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
The problem is that plugins also provides resource support, and for lookup purposes for users there really should be some code that iterates and presents them. Like we do for config and for macros.
comment:4 by , 12 years ago
Description: | modified (diff) |
---|---|
Keywords: | authzpolicy added |
comment:5 by , 10 years ago
Milestone: | next-minor-0.12.x → next-stable-1.0.x |
---|
Moving this forward since I don't think it needs to be fixed on 0.12-stable, but please comment if you feel differently.
We may want to consider this within the context of a more extensive rework of the permission system in which IPermissionRequestor
may define actions associated with realms: trunk/trac/perm.py@12930:152-154#L117. Something like,
- actions = ['WIKI_CREATE', 'WIKI_DELETE', 'WIKI_MODIFY', 'WIKI_RENAME', - 'WIKI_VIEW'] - return actions + [('WIKI_ADMIN', actions)] + actions = ['CREATE', 'DELETE', 'MODIFY', 'RENAME', 'VIEW'] + return {'wiki': actions + [('ADMIN', actions)]}
That's not a fully developed idea though.
comment:6 by , 9 years ago
Milestone: | next-stable-1.0.x → next-dev-1.1.x |
---|
comment:7 by , 9 years ago
Milestone: | next-dev-1.1.x → next-dev-1.3.x |
---|
Narrowing focus for milestone:1.2. Please move ticket to milestone:1.2 if you intend to fix it.
comment:8 by , 7 years ago
there really should be some code that iterates and presents them. Like we do for config and for macros.
-
trac/wiki/macros.py
diff -r a3e91091080a trac/wiki/macros.py
a b 24 24 25 25 from trac.core import * 26 26 from trac.resource import ( 27 Resource, ResourceNotFound, get_resource_name, get_resource_summary,28 get_resource_ url27 Resource, ResourceNotFound, ResourceSystem, get_resource_name, 28 get_resource_summary, get_resource_url 29 29 ) 30 30 from trac.util import as_int 31 31 from trac.util.datefmt import format_date, from_utimestamp, user_time … … 903 903 for mime_type in sorted(mime_types)))) 904 904 905 905 906 class KnownRealmsMacro(WikiMacroBase): 907 _domain = 'messages' 908 _description = cleandoc_( 909 """List all known realms which can be used with TracFineGrainedPermissions. 910 911 Can be given an optional argument which is interpreted as realm filter. 912 """) 913 914 def expand_macro(self, formatter, name, content): 915 realm_filter = '' 916 args, kw = parse_args(content) 917 if args: 918 realm_filter = args.pop(0).strip().rstrip('*') 919 920 resource_sys = ResourceSystem(self.env) 921 realms = [] 922 for realm in resource_sys.get_known_realms(): 923 if not realm_filter or realm.startswith(realm_filter): 924 try: 925 summary = get_resource_summary(self.env, Resource(realm)) 926 except Exception as e: 927 summary = 'ERROR ' + str(e) 928 realms.append((realm, summary)) 929 930 return tag.div(class_='trac-realms')( 931 tag.table(class_='wiki')( 932 tag.thead(tag.tr( 933 tag.th(_("Realm")), 934 tag.th(_("Summary")))), 935 tag.tbody( 936 tag.tr(tag.th(tag.code(realm), 937 style="text-align: left"), 938 tag.td(tag.code( 939 summary 940 ))) 941 for realm, summary in sorted(realms)))) 942 943 906 944 class TracGuideTocMacro(WikiMacroBase): 907 945 _domain = 'messages' 908 946 _description = cleandoc_(
[[KnownRealms()]]
shows:
Realm | Summary |
---|---|
attachment | Unparented attachment None |
changeset | Changeset None |
milestone | Milestone None |
repository | Default repository |
source | ERROR 'NoneType' object has no attribute 'get_node' |
ticket | ERROR coercing to Unicode: need string or buffer, NoneType found |
wiki |
comment:9 by , 7 years ago
The realm summary isn't useful, but a comma-separated list might be enough.
comment:11 by , 5 years ago
Milestone: | next-dev-1.5.x → next-major-releases |
---|
Some documentation effort about this is certainly welcome, thanks!