| 1 | [[PageOutline(2-5,Contents,pullout)]] |
| 2 | |
| 3 | = TracPermissionFilter = |
| 4 | |
| 5 | == Description == |
| 6 | |
| 7 | Plugin to remove Trac permissions using a blacklist and/or a whitelist. |
| 8 | |
| 9 | This hack was born to be able to ''archive'' projects without touching the |
| 10 | Trac database, the idea is to use the filter to disable all permissions that |
| 11 | allow users to modify it without changing their permissions on the database |
| 12 | and be able to restore the project to the original state simply disabling the |
| 13 | filter. |
| 14 | |
| 15 | To filter permissions as desired the plugin has to be the first one on the |
| 16 | `permission_policy` list and it works as follows: |
| 17 | |
| 18 | 1. If the `blacklist` is available and the permission being considered is on |
| 19 | the list the `check_permission` function returns `False` and the |
| 20 | permission evaluation stops. |
| 21 | |
| 22 | 2. If the `whitelist` is available and the permission we are checking is not |
| 23 | on the list the `check_permission` function returns `False` and the |
| 24 | permission evaluation stops. |
| 25 | |
| 26 | 3. If the evaluation gets here the permission is ignored by the plugin and |
| 27 | the next permission policy is checked. |
| 28 | |
| 29 | |
| 30 | == Bugs/Feature Requests == |
| 31 | |
| 32 | Existing bugs and feature requests for TracPermissionFilterPlugin are |
| 33 | [report:9?COMPONENT=TracPermissionFilterPlugin here]. |
| 34 | |
| 35 | If you have any issues, create a |
| 36 | [http://trac-hacks.org/newticket?component=TracPermissionFilterPlugin&owner=sto new ticket]. |
| 37 | |
| 38 | == Download == |
| 39 | |
| 40 | Download the zipped source from [download:tracpermissionfilterplugin here]. |
| 41 | |
| 42 | == Source == |
| 43 | |
| 44 | You can check out TracPermissionFilterPlugin from [http://trac-hacks.org/svn/tracpermissionfilterplugin here] using Subversion, or [source:tracpermissionfilterplugin browse the source] with Trac. |
| 45 | |
| 46 | == Example == |
| 47 | |
| 48 | After enabling the plugin in your `trac.ini`: |
| 49 | |
| 50 | {{{ |
| 51 | tracpermissionfilter.* = enabled |
| 52 | }}} |
| 53 | |
| 54 | Add a section with the list of permissions to allow: |
| 55 | |
| 56 | {{{ |
| 57 | [permission-filter] |
| 58 | whitelist = BROWSER_VIEW,CHANGESET_VIEW,FILE_VIEW,LOG_VIEW,MILESTONE_VIEW,REPORT_SQL_VIEW,REPORT_VIEW,ROADMAP_VIEW,SEARCH_VIEW,TICKET_VIEW,TIMELINE_VIEW,WIKI_VIEW |
| 59 | }}} |
| 60 | |
| 61 | or a list of permissions to deny: |
| 62 | |
| 63 | {{{ |
| 64 | [permission-filter] |
| 65 | blacklist = BROWSER_VIEW |
| 66 | }}} |
| 67 | |
| 68 | And remember to put the filter the first on your project `permission_policies`: |
| 69 | |
| 70 | {{{ |
| 71 | [trac] |
| 72 | permission_policies = PermissionFilter, DefaultPermissionPolicy |
| 73 | }}} |
| 74 | |
| 75 | |
| 76 | == Recent Changes == |
| 77 | |
| 78 | [[ChangeLog(tracpermissionfilterplugin, 3)]] |
| 79 | |
| 80 | == Author/Contributors == |
| 81 | |
| 82 | '''Author:''' [wiki:sto] [[BR]] |
| 83 | '''Maintainer:''' [wiki:sto] [[BR]] |
| 84 | '''Contributors:''' |