Package tracopt :: Package perm :: Module authz_policy :: Class AuthzPolicy

Class AuthzPolicy

source code

         object --+    
                  |    
trac.core.Component --+
                      |
                     AuthzPolicy

Permission policy using an authz-like configuration file.

Refer to SVN documentation for syntax of the authz file. Groups are supported.

As the fine-grained permissions brought by this permission policy are often used in complement of the other permission policies (like the DefaultPermissionPolicy), there's no need to redefine all the permissions here. Only additional rights or restrictions should be added.

=== Installation === Enabling this policy requires listing it in trac.ini:

{{{
[trac]
permission_policies = AuthzPolicy, DefaultPermissionPolicy

[authz_policy]
authz_file = conf/authzpolicy.conf
}}}

This means that the AuthzPolicy permissions will be checked first, and only if no rule is found will the DefaultPermissionPolicy be used.

=== Configuration === The authzpolicy.conf file is a .ini style configuration file.

Example configuration:

{{{
[groups]
administrators = athomas

[*/attachment:*]
* = WIKI_VIEW, TICKET_VIEW

[wiki:WikiStart@*]
@administrators = WIKI_ADMIN
anonymous = WIKI_VIEW
* = WIKI_VIEW

# Deny access to page templates
[wiki:PageTemplates/*]
* =

# Match everything else
[*]
@administrators = TRAC_ADMIN
anonymous = BROWSER_VIEW, CHANGESET_VIEW, FILE_VIEW, LOG_VIEW,
    MILESTONE_VIEW, POLL_VIEW, REPORT_SQL_VIEW, REPORT_VIEW,
    ROADMAP_VIEW, SEARCH_VIEW, TICKET_CREATE, TICKET_MODIFY,
    TICKET_VIEW, TIMELINE_VIEW,
    WIKI_CREATE, WIKI_MODIFY, WIKI_VIEW
# Give authenticated users some extra permissions
authenticated = REPO_SEARCH, XML_RPC
}}}
Nested Classes

Inherited from trac.core.Component: __metaclass__

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
check_permission(self, action, username, resource, perm) source code
 
parse_authz(self) source code
 
normalise_resource(self, resource) source code
 
authz_permissions(self, resource_key, username) source code

Inherited from trac.core.Component: __repr__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods

Inherited from trac.core.Component: implements

Class Variables
  authz_file = <PathOption [authz_policy] 'authz_file'>
Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)