10 | | - the resource to which the wiki text belongs (`.env`, `.resource`, `.id`) |
11 | | - its parent context, if there's one (`.parent`) |
12 | | - how the rendered Wiki text is being accessed (`.req`, `.abs_urls`) so that the proper links can be generated (`.href`, `.self_href`) |
| 11 | - Identify the resource to which the wiki text belongs (`.env`, `.realm`, `.id`) |
| 12 | - Access to parent context, if there's one (`.parent`) [[br]] |
| 13 | By extension, this enables one to unwind the stack of context embedding |
| 14 | - Knows about how the rendered Wiki text is being accessed (`.req`, `.abs_urls`) |
| 15 | so that the proper links can be generated: |
| 16 | - `.href`: the appropriate Href instance for generating any kind of links |
| 17 | - `.self_href`: a link targeting the current Wiki context itself [[br]] |
| 18 | ''renamed to `.resource_href` in the security branch'' |
| 19 | - ''Allow easy access to the corresponding resource itself (`.resource`) - security branch only'' |
19 | | - `Context(env, req)`: a global context, not attached to a particular resource |
20 | | - `Context(env, req, 'wiki', 'WikiStart')`: a context for the WikiStart wiki page |
21 | | - assuming `ctxt` is a Context instance, `ctxt('ticket', ticket.id)` creates a subcontext focusing on a specific `ticket`. |
| 26 | - `Context(env, req)`: a toplevel context, not attached to a particular resource |
| 27 | - `Context(env, req)('wiki', 'WikiStart')`: a context for the WikiStart wiki page |
| 28 | - assuming `ctxt` is already some Context instance, |
| 29 | `ctxt('ticket', ticket.id)` creates a sub-context for a specific `ticket`. |
| 65 | |
| 66 | == Future Directions == |
| 67 | |
| 68 | === Fine-grained Permission Checking === |
| 69 | |
| 70 | The source:sandbox/security branch already contains a much empowered version of the Context class. |
| 71 | |
| 72 | As a context can describe precisely ''which'' resource is accessed and at the same time ''how'' it is accessed (and more specifically ''who'' accesses it), it is also a perfect fit for the fine-grained PermissionPolicy (see also the [PermissionPolicy@16 design document]). |
| 73 | |
| 74 | In order to be used as a lightweight descriptor of a resource, Context can also be subclassed. The user of a context doesn't need to have to think about this, as the correct subclass is always used, based on the `.realm` information. |
| 75 | |
| 76 | === Multiple Project Support === |
| 77 | |
| 78 | Attaching the `.project` information to a Context, as an additional identifier for a Context would be a convenient way to convey the notion of a "current" project. |
| 79 | Therefore, TracLinks found in a wiki text will naturally be based in the same project as the one specified by the current WikiContext. |
| 80 | |
| 81 | InterTrac links, on the other hand, would have to be used to refer to a resource found in ''another'' project. This is a natural extension for InterTrac prefixes, which are already used to refer to resources located in ''external environments''. It would only take to identify the InterTrac prefixes corresponding to sibling projects for having this mechanism working for targeting ''other projects'' in the ''same environment''. |
| 82 | |