wiki:TracConfigurablePermissionPlugin

Version 2 (modified by Cauly, 6 years ago) (diff)

--

TracConfigurablePermissionPlugin

Description

This plugin provides configurable and powerful permission control to ticket and wiki system.

Custom Actions/Permissions

Supports for adding custom actions and permissions in trac.ini section configuratable-permission.

Syntax: (action_name) = enabled|disabled , where:

  • (action_name): The action/permission you want to add. Will auto capitalized in Trac.
  • enabled|disabled: If the action is enabled/disabled.

Examples:

[configuratable-permission]
view_bug_ticket = enabled
view_bug_wiki = enabled

Custom permission rules/policy

Supports for adding custom permission rules to ticket and wiki system.

To enable this function, first add 'ConfigurablePermissionPolicy' to permission_policies option, prior to DefaultPermissionPolicy recommanded.

[trac]
permission_policies = ConfigurablePermissionPolicy,ReadonlyWikiPolicy,DefaultPermissionPolicy,LegacyAttachmentPolicy

Syntax for a custom permission rule:(rule_name) = ticket|wiki, (action), (matching_condition), (permission), (result), where:

  • (rule_name): The rule name, which does not really affect the function of rule. However the trac will auto sort the trac.ini, and order of rules matters, so the naming should consider sorting.
  • ticket|wiki: Whether the rule applies to ticket system or wiki system.
  • (action): What action triggers the rule. Can be set to empty or '*' to match all actions, or set to a specific action such as 'TICKET_VIEW'
  • (matching_condition): Only those objects that match the conditions apply to the rule.
    • for ticket permission rule, it can be set to empty or '*' to match all tickets, or set to a query such as 'type=bug'
    • for wiki permission rule, it matches the name of wiki
  • (permission): Those users with given permission applies to the rule. Can be set to empty or '*' which means everyone. Can be used with custom permission mentioned above, such as 'VIEW_BUG_TICKET'
  • (result): What will the permission system do to matched objects, can be one of the following values:
    • allow: Explicitly allow this action, no further policy group will be applied.
    • allow-only: Explicitly allow this action, and deny all other users without the given permission. No further policy group will be applied.
    • deny: Explicitly deny this action, No further policy group will be applied.
    • pass: Leave this action to further policy groups, such as DefaultPermissionPolicy. Recommanded against 'allow'.
    • pass-only: Leave this action to further policy groups, such as DefaultPermissionPolicy, and deny all other users without the given permission. Recommanded against 'allow-only'.

Examples:

[configuratable-permission-rules]
view_bug = ticket, TICKET_VIEW, type=bug, VIEW_BUG_TICKET, pass-only

This rule reads: 'Pass user with VIEW_BUG_TICKET permission for viewing tickets that matches type=bug, and deny those users without VIEW_BUG_TICKET permission' This rule is equivalent to:

view_bug1 = ticket, TICKET_VIEW, type=bug, *, deny
view_bug2 = ticket, TICKET_VIEW, type=bug, VIEW_BUG_TICKET, pass
[configuratable-permission-rules]
view_feature_wiki = wiki, *, Feature, VIEW_BUG_WIKI, deny

This rule reads: 'Deny all user with VIEW_BUG_WIKI permission for all actions to wiki naming Feature'

Bugs/Feature Requests

Existing bugs and feature requests for TracConfigurablePermissionPlugin are here.

If you have any issues, create a new ticket.

defect

2 / 2

task

1 / 1

Download

Download the zipped source from here.

Source

You can check out TracConfigurablePermissionPlugin from here using Git, or browse the source.

Installation

General instructions on installing Trac plugins can be found on the TracPlugins page.

Author/Contributors

Author: cauly
Maintainer: Cauly
Contributors: