Changes between Version 1 and Version 2 of Trac Fine Grained Permissions


Ignore:
Timestamp:
Jul 25, 2010, 3:04:54 PM (14 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Trac Fine Grained Permissions

    v1 v2  
    55Since 0.11, there's a general mechanism in place that allows custom permission policy plugins to grant or deny any action on any kind of Trac resources, even at the level of specific versions of such resources.
    66
     7Note that for Trac 0.12, `authz_policy` has been integrated in trunk branch as `tracopt.perm.authz_policy.*`
     8
    79== Permission Policies ==
    810
     
    1012
    1113An example policy based on an Authz-style system has been added. See
    12 [source:trunk/sample-plugins/permissions/authz_policy.py] for details. (See also [source:trunk/sample-plugins/permissions] for more samples.)
     14[trac:source:branches/0.11-stable/sample-plugins/permissions/authz_policy.py authz_policy.py] for details (current version requires >= Python 2.4). (See also [trac:source:branches/0.11-stable/sample-plugins/permissions sample-plugins/permissions] for more samples.)
    1315
    1416 - Install [http://www.voidspace.org.uk/python/configobj.html ConfigObj] (required).
    1517 - Copy authz_policy.py into your plugins directory.
    16  - Put a [http://swapoff.org/files/authzpolicy.conf authzpolicy.conf] file somewhere (preferably on a secured location on the server, not readable for others than the webuser.
     18 - Put a [http://swapoff.org/files/authzpolicy.conf authzpolicy.conf] file somewhere, preferably on a secured location on the server, not readable for others than the webuser. If the  file contains non-ASCII characters, the UTF-8 encoding should be used.
    1719 - Update your `trac.ini`:
     20   1. modify the [TracIni#trac-section permission_policies] entry in the `[trac]` section
    1821{{{
    1922[trac]
    2023...
    2124permission_policies = AuthzPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
    22 
     25}}}
     26   2. add a new `[authz_policy]` section
     27{{{
    2328[authz_policy]
    2429authz_file = /some/trac/env/conf/authzpolicy.conf
    25 
     30}}}
     31   3. enable the single file plugin
     32{{{
    2633[components]
    2734...
    28 authz_policy = enabled
     35authz_policy.* = enabled
    2936}}}
    3037
     
    6168=== mod_authz_svn-like permission policy ===
    6269
    63 At the time of this writing, the old fine grained permissions system from Trac 0.10 and before used for restricting access to the repository has not yet been converted to a permission policy component, but from the user point of view, this makes little if no differences.
     70At the time of this writing, the old fine grained permissions system from Trac 0.10 and before used for restricting access to the repository has not yet been converted to a permission policy component, but from the user point of view, this makes little if no difference.
    6471
    6572That kind of fine-grained permission control needs a definition file, which is the one used by Subversion's mod_authz_svn.
    66 More information about this file format and about its usage in Subversion is available in the [http://svnbook.red-bean.com/svnbook/book.html#svn-ch-6-sect-4.4.2 Subversion Book (Per-Directory Access Control)].
     73More information about this file format and about its usage in Subversion is available in the  [http://svnbook.red-bean.com/en/1.5/svn.serverconfig.pathbasedauthz.html Path-Based Authorization] section in the Server Configuration chapter of the svn book.
    6774
    6875Example:
     
    9299}}}
    93100
    94 if you want to support the use of the `[`''modulename''`:/`''some''`/`''path''`]` syntax within the `authz_file`, add
     101If you want to support the use of the `[`''modulename''`:/`''some''`/`''path''`]` syntax within the `authz_file`, add
    95102
    96103{{{
     
    98105}}}
    99106
    100 where ''modulename'' refers to the same repository indicated by the `repository_dir` entry in the `[trac]` section.
     107where ''modulename'' refers to the same repository indicated by the `repository_dir` entry in the `[trac]` section. As an example, if the `repository_dir` entry in the `[trac]` section is {{{/srv/active/svn/blahblah}}}, that would yield the following:
     108
     109{{{
     110[trac]
     111authz_file = /path/to/svnaccessfile
     112authz_module_name = blahblah
     113...
     114repository_dir = /srv/active/svn/blahblah
     115}}}
     116
     117where the svn access file, {{{/path/to/svnaccessfile}}}, contains entries such as {{{[blahblah:/some/path]}}}.
    101118
    102119'''Note:''' Usernames inside the Authz file __must__ be the same as those used inside trac.
     
    117134For information about how to restrict access to entire projects in a multiple project environment see [trac:wiki:TracMultipleProjectsSVNAccess]
    118135
     136== Getting TracFineGrainedPermissions to work ==
     137
     138Don't forget to restart Trac engine to apply new configuration if you are running tracd standalone server.
     139
    119140----
    120 See also: TracPermissions
     141See also: TracPermissions,
     142[http://trac-hacks.org/wiki/FineGrainedPageAuthzEditorPlugin TracHacks:FineGrainedPageAuthzEditorPlugin] for a simple editor plugin.