| 97 | |
| 98 | == Creating New Privileges == |
| 99 | From [http://nil.checksite.co.uk/index.cfm/2008/1/14/trac-0-11-creating-your-own-permissions] |
| 100 | |
| 101 | To add permissions to you simply need to add a myPermissions.py file to your Trac environment plugin folder that looks like this: |
| 102 | |
| 103 | |
| 104 | {{{ |
| 105 | from trac.core import Component, implements |
| 106 | from trac.perm import IPermissionRequestor |
| 107 | class MyPermissions(Component): |
| 108 | implements(IPermissionRequestor) |
| 109 | def get_permission_actions(self): |
| 110 | #comma separated list of new permissions |
| 111 | return ('TICKET_CLOSE','TICKET_DEFER') |
| 112 | }}} |
| 113 | |
| 114 | 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. |
| 115 | |
| 116 | You can now use these permission in your work flow against actionname.permissions entries. |
| 117 | |
| 118 | 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. |