Edgewall Software

Changes between Version 75 and Version 76 of TracPermissions


Ignore:
Timestamp:
Dec 8, 2010, 3:47:36 PM (13 years ago)
Author:
Remy Blank
Comment:

No need for a custom plugin just to add custom permissions.

Legend:

Unmodified
Added
Removed
Modified
  • TracPermissions

    v75 v76  
    8888|| `PERMISSION_ADMIN` || All `PERMISSION_*` permissions ||
    8989
    90 
    9190=== Others ===
    9291
     
    9796
    9897== 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.
     98
     99To create custom permissions, for example to be used in a custom workflow, enable the optional `tracopt.perm.config_perm_provider.ExtraPermissionsProvider` component in the "Plugins" admin panel, and add the desired permissions to the `[extra-permissions]` section in your [wiki:TracIni#extra-permissions-section trac.ini]. For more information, please refer to the documentation of the component in the admin panel.
    119100
    120101== Granting Privileges ==