| 74 | |
| 75 | == Creating New Privileges == |
| 76 | |
| 77 | (From http://nil.checksite.co.uk/index.cfm/2008/1/14/trac-0-11-creating-your-own-permissions) |
| 78 | |
| 79 | To add permissions to Trac 0.11 you simply need to add a myPermissions.py file to your Trac environment plugin folder that looks like this: |
| 80 | |
| 81 | |
| 82 | {{{ |
| 83 | from trac.core import Component, implements |
| 84 | from trac.perm import IPermissionRequestor |
| 85 | class MyPermissions(Component): |
| 86 | implements(IPermissionRequestor) |
| 87 | def get_permission_actions(self): |
| 88 | #comma separated list of new permissions |
| 89 | return ('TICKET_CLOSE','TICKET_DEFER') |
| 90 | }}} |
| 91 | |
| 92 | Add your set of permissions to the return command in place of 'MY_FIRST_PERM', 'MY_SECOND_PERM', restart apache and you should be away. |
| 93 | |
| 94 | You can now use these permission in your work flow against actionname.permissions entries. |
| 95 | |
| 96 | NOTE: you don't need to call the file "myPermissions.py" - its just needs to be a python file with a name of your choosing. |