Edgewall Software

Changes between Version 11 and Version 12 of 0.11/TracPermissions


Ignore:
Timestamp:
Dec 8, 2010, 5:06:57 PM (9 years ago)
Author:
Remy Blank
Comment:

Moved 0.11-specific information from TracPermission.

Legend:

Unmodified
Added
Removed
Modified
  • 0.11/TracPermissions

    v11 v12  
    6666|| `PERMISSION_ADMIN` || All `PERMISSION_*` permissions ||
    6767
    68 
    6968=== Others ===
    7069
     
    7372|| `CONFIG_VIEW` || Enables additional pages on ''About Trac'' that show the current configuration or the list of installed plugins ||
    7473|| `EMAIL_VIEW` || Shows email addresses even if [wiki:0.11/TracIni `trac show_email_addresses` configuration optoin is `false`] ||
     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
     79To 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{{{
     83from trac.core import Component, implements
     84from trac.perm import IPermissionRequestor
     85class 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
     92Add 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
     94You can now use these permission in your work flow against actionname.permissions entries.
     95
     96NOTE: you don't need to call the file "myPermissions.py" - its just needs to be a python file with a name of your choosing.
    7597
    7698== Granting Privileges ==