Configurare trac su svn e ldap

Trac è un strumento meraviglioso: è un'applicazione web modulare scritta in python studiata per la gestione collaborativa di progetti software.

Si aggancia a un SCM, ad es. svn e offre:

  • l'esplorazione del repository via browser
  • l'apertura e la gestione di ticket
  • un wiki
  • la gestione delle timeline
  • la gestione delle roadmap
  • la ricerca all'interno del sito

Ma gli aspetti più cool di trac sono: il plugin ldap per la gestione delle acl, i plugin per eclipse che consentono ad es. di gestire direttamente in eclipse i ticket aperti su trac.

 

 

Come si sa, dopo le belle notizie arrivano quelle brutte (life sucks) :-D

Tanto è bello Trac, tanto è ostico per i novizi, specie per coloro i quali (come me) non hanno grande dimestichezza con python. Questo è il motivo per cui so ed avviso che questa guida potrebbe avere qualche imprecisione in più del solito. (ogni aiuto è gradito).

References: la documentazione del sito è vasta anche se a parer mio non è molto scorrevole, piuttosto difficile alla lettura.

 

Installazione in debian

Fortunatamente esistono i pacchetti:

apt-get install trac trac-spamfilter

Volendo si può seguire questa guida per debian ma se si utilizza una versione recente (es. Lenny stable) non è necessario.

Trac può usare diversi back-end per salvare i propri dati. Il backend di default è SQLite e ho deciso che mi va bene questo (almeno per il momento, visto che il manuale dice "MySQL support is currently still experimental" e i bachi sembrano essere diversi). Naturalmente questo richiederà una diversificazione nelle procedure di backup.

 

A differenza dei più noti cms, trac viene gestito tramite linea di comando. Solo in un secondo momento quando la configurazione di base sarà sistemata, allora si potrà usare l'interfaccia web.

La prima necessità di trac è quella di importare almeno un repository e di inizializzare il proprio ambiente di lavoro.

Identifico una directory nella quale inizializzerò tutti i repository necessari: /var/www/trac

mkdir /var/www/trac
chown www-data:www-data /var/www/trac

attivo la procedura che genererà l'ambiente per il progetto hello_world

trac-admin /var/www/trac/hello_world initenv


Creating a new Trac environment at /var/www/trac/hello_world
Trac will first ask a few questions about your environment
in order to initialize and prepare the project database.

 Please enter the name of your project.
 This name will be used in page titles and descriptions.

Project Name [My Project]> Hello World 
 Please specify the connection string for the database to use.
 By default, a local SQLite database is created in the environment
 directory. It is also possible to use an already existing
 PostgreSQL database (check the Trac documentation for the exact
 connection string syntax).

Database connection string [sqlite:db/trac.db]>
 
 Please specify the type of version control system,
 By default, it will be svn.

 If you don't want to use Trac with version control integration,
 choose the default here and don't specify a repository directory.
 in the next question.

Repository type [svn]>

 Please specify the absolute path to the version control
 repository, or leave it blank to use Trac without a repository.
 You can also set the repository location later.

Path to repository [/path/to/repos]> /svn/hello_world

Creating and Initializing Project

[cut]

Il processo termina cosi

---------------------------------------------------------------------
Project environment for 'Hello World' created.

You may now configure the environment by editing the file:

  /var/www/trac/hello_world/conf/trac.ini

If you'd like to take this new project environment for a test drive,
try running the Trac standalone web server `tracd`:

  tracd --port 8000 /var/www/trac/hello_world 
Then point your browser to http://localhost:8000/hello_world.

Se vado a vedere cosa è successo ottengo:

tree -L 1 /var/www/trac/hello_world/
/var/www/trac/smak/
|-- README
|-- VERSION
|-- attachments
|-- conf
|-- db
|-- htdocs
|-- log
|-- plugins
`-- templates

Trac ha creato il suo skeleton ed ha popolato la directory e siamo in grado di vederlo atttraverso il browser: ma attenzione! Trac dispone di un proprio webserver per il quale si può impostare la porta e che può essere lanciato con il comando in grassetto, ma escludo a priori questa possibilità e passo direttamente alla configurazione di apache in modo che non debba avere due webserver sullo stesso host.

Tra i file creati, quello che ha più rilevanza dal punto di vista della configurazione, è /var/www/trac/hello_world/conf/trac.ini che, appena dopo l'installazione si presenta cosi:

# -*- coding: utf-8 -*-

[attachment]
max_size = 262144
render_unsafe_content = false

[browser]
color_scale = True
downloadable_paths = /trunk, /branches/*, /tags/*
hide_properties = svk:merge
intermediate_color =
intermediate_point =
newest_color = (255, 136, 136)
oldest_color = (136, 136, 255)
oneliner_properties = trac:summary
render_unsafe_content = false
wiki_properties = trac:description

[changeset]
max_diff_bytes = 10000000
max_diff_files = 0
wiki_format_messages = true

[header_logo]
alt = (please configure the [header_logo] section in trac.ini)
height = -1
link =
src = site/your_project_logo.png
width = -1

[inherit]
plugins_dir =
templates_dir =

[logging]
log_file = trac.log
# log_format = <inherited>
log_level = DEBUG
log_type = none

[milestone]
stats_provider = DefaultTicketGroupStatsProvider

[mimeviewer]
enscript_modes = text/x-dylan:dylan:4
enscript_path = enscript
max_preview_size = 262144
mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb
php_path = php
pygments_default_style = trac
pygments_modes =
tab_width = 8

[notification]
admit_domains =
always_notify_owner = false
always_notify_reporter = false
always_notify_updater = true
ignore_domains =
mime_encoding = base64
smtp_always_bcc =
smtp_always_cc =
smtp_default_domain =
smtp_enabled = false
smtp_from = trac@localhost
smtp_from_name =
smtp_password =
smtp_port = 25
smtp_replyto = trac@localhost
smtp_server = localhost
smtp_subject_prefix = __default__
smtp_user =
ticket_subject_template = $prefix #$ticket.id: $summary
use_public_cc = false
use_short_addr = false
use_tls = false

[project]
admin =
descr = My example project
footer = Visit the Trac open source project at<br /><a href="http://trac.edgewall.org/">http://trac.edgewall.org/</a>
icon = common/trac.ico
name = Hello World
url =

[query]
default_anonymous_query = status!=closed&cc~=$USER
default_query = status!=closed&owner=$USER
items_per_page = 100

[report]
items_per_page = 100
items_per_page_rss = 0

[revisionlog]
default_log_limit = 100

[roadmap]
stats_provider = DefaultTicketGroupStatsProvider

[search]
min_query_length = 3

[spam-filter]
akismet_api_key =
akismet_api_url = rest.akismet.com/1.1/
akismet_karma = 5
attachment_sample_size = 16384
bayes_karma = 10
bayes_min_training = 25
extlinks_karma = 2
ip_blacklist_karma = 5
ip_blacklist_servers = bsb.empty.us, sc.surbl.org
ip_throttle_karma = 3
logging_enabled = true
max_external_links = 4
max_posts_by_ip = 10
min_karma = 0
purge_age = 7
regex_karma = 5
session_karma = 9
trust_authenticated = true

[svn]
branches = trunk,branches/*
tags = tags/*

[ticket]
default_cc =
default_component =
default_description =
default_keywords =
default_milestone =
default_owner =
default_priority = major
default_resolution = fixed
default_severity =
default_summary =
default_type = defect
default_version =
max_description_size = 262144
preserve_newlines = default
restrict_owner = false
workflow = ConfigurableTicketWorkflow

[ticket-workflow]
accept = new,assigned,accepted,reopened -> accepted
accept.operations = set_owner_to_self
accept.permissions = TICKET_MODIFY
leave = * -> *
leave.default = 1
leave.operations = leave_status
reassign = new,assigned,accepted,reopened -> assigned
reassign.operations = set_owner
reassign.permissions = TICKET_MODIFY
reopen = closed -> reopened
reopen.operations = del_resolution
reopen.permissions = TICKET_CREATE
resolve = new,assigned,accepted,reopened -> closed
resolve.operations = set_resolution
resolve.permissions = TICKET_MODIFY

[timeline]
abbreviated_messages = true
changeset_collapse_events = false
changeset_long_messages = false
changeset_show_files = 0
default_daysback = 30
max_daysback = 90
newticket_formatter = oneliner
ticket_show_details = false

[trac]
authz_file =
authz_module_name =
auto_reload = False
base_url =
check_auth_ip = true
database = sqlite:db/trac.db
default_charset = iso-8859-15
default_handler = WikiModule
default_timezone =
htdocs_location =
ignore_auth_case = false
mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
metanav = login,logout,prefs,help,about
permission_policies = DefaultPermissionPolicy, LegacyAttachmentPolicy
permission_store = DefaultPermissionStore
repository_dir = /svn/hello_world
repository_type = svn
# request_filters = <inherited>
show_email_addresses = false
timeout = 20
use_base_url_for_redirect = False

[wiki]
ignore_missing_pages = false
render_unsafe_content = false
split_page_names = false

In trac.ini avviene l' abilitazione e la configurazione dei plugin di trac.

 

Apache

Apache dispone di 4 diversi moduli per far girare trac, cgi, fastCGI, python e wsgi. Ne va scelto uno e ciascuno ha una propria configurazione: io ho optato per l'ultimo, più recente e, a detta di tutti, con ottime prestazioni ed una buona stabilità.

apt-get install libapache2-mod-wsgi
a2enmod wsgi

Configuro wsgi seguendo questa guida

Creo il file mysite.wsgi in cui vado a descrivere dove si trova il "repository" di trac (non c'entra niente con il repository svn)

vim /usr/share/pyshared/trac/htdocs/mysite.wsgi
import os

os.environ['TRAC_ENV_PARENT_DIR'] = '/var/www/trac'
os.environ['PYTHON_EGG_CACHE'] = '/tmp/'

import trac.web.main
application = trac.web.main.dispatch_request

Questo file dovrà essere specificato nella configurazione di apache e verrà utilizzato da wsgi.

Ora configuro apache con un virtual host dedicato a trac (non è necessario usare un vhost!) [in grassetto le parti da modificare a seconda delle proprie necessità]

<VirtualHost *:80>
        ServerName trac.mysite.com
        DocumentRoot /var/www/trac
        # Possible values include: debug, info, notice, warn, error, crit, alert, emerg
        LogLevel debug
        ErrorLog /var/log/apache2/trac.mysite.com_error.log
        CustomLog /var/log/apache2/trac.mysite.com_access.log combined

        WSGIScriptAlias / /usr/share/pyshared/trac/htdocs/mysite.wsgi
        <Directory /var/www/trac>
                WSGIApplicationGroup %{GLOBAL}
                AllowOverride None
                Order deny,allow
                Deny from all
                Allow from 192.168.0.0/255.255.0.0
        </Directory>
</VirtualHost>

Riavviando apache e puntando il browser su http://trac.mysite.com/hello_world vedo il sito.

La prima cosa che mi ha lasciato sconcertato è stato il meccanismo di autenticazione: trac, out of the box, non dispone di meccanismi di autenticazione! In pratica cliccando sul link LOGIN presente nel menu di trac, dice

Trac Error
Authentication information not available. Please refer to the installation documentation. 

Se dapprima mi sono sorpreso, poi ho capito che è una scelta molto cool. Trac, di base, si aspetta che sia apache a fare l'autenticazione per lui, uno po come fa svn, mentre dispone di un proprio meccanismo di acl che, a differenza di svn, può essere esteso a mezzo del plugin ldap e che viene gestito da riga di comando (Almeno fino a quando non si ottiene accesso all'interfaccia di amministrazione via web, ovvero DOPO aver fatto login).

Quindi cosa manca? 2 fasi:

  • A) autenticazione utente; si fa come nel post svn: apache, acl e ldap. howto?
  • B) gestione acl, e la voglio fare appoggiandomi ad ldap per la definizione dei gruppi =>
  •     B1) installazione su trac del plugin per ldap
  •     B2) modifica struttura ldap
  •     B3) configurazione trac per operare su ldap
  •     B4) scrittura acl

Prima di procedere mi domando: che genere di restrizioni che devo implementare per il sito? Nella maggior parte dei casi gran parte delle informazioni saranno pubbliche: ad es. il WIKI, la consultazione dei BUG mentre altre come l'inserimento di BUG sarà soggetto ad autenticazione.

 

A) Autenticazione utente via apache e ldap

Quindi devo consentire l'accesso anonimo in molte parti del sito. Ecco perchè configuro apache per richiedere un valid user solo sulla location hello_world/login. Quindi posso modificare il vhost in questo modo.

<VirtualHost *:80>
        ServerName trac.mysite.com
        DocumentRoot /var/www/trac
        # Possible values include: debug, info, notice, warn, error, crit, alert, emerg
        LogLevel debug
        ErrorLog /var/log/apache2/trac.mysite.com_error.log
        CustomLog /var/log/apache2/trac.mysite.com_access.log combined

        WSGIScriptAlias / /usr/share/pyshared/trac/htdocs/mysite.wsgi
        <Directory /var/www/trac>
                WSGIApplicationGroup %{GLOBAL}
                AllowOverride None
                Order deny,allow
                Deny from all
                Allow from 192.168.0.0/255.255.0.0
        </Directory>

        <Location /hello_world>
                AuthType Basic
                AuthName "Hello World"
                Order Allow,Deny
                Allow from All

                # Make LDAP the authentication mechanism
                AuthBasicProvider ldap

                # Make LDAP authentication is final
                AuthzLDAPAuthoritative on

                # Active Directory requires an authenticating DN to access records
                AuthLDAPBindDN "cn=admin,dc=mysite,dc=com"

                # This is the password for the AuthLDAPBindDN user in Active Directory
                AuthLDAPBindPassword YOUR_PASSWORD_HERE

                # The LDAP query URL
                AuthLDAPURL "ldap://localhost:389/ou=users,dc=mysite,dc=com?uid?sub?(objectClass=*)"
        </Location>
        <Location /hello_world/login>
                # Some options like AuthType and AuthUserFile
                Require valid-user
        </Location>
</VirtualHost>

 

B1) Installazione Plugin Ldap

Reference: sito ufficiale del plugin

Scarico il codice:

mkdir /tmp/ldapplugin
cd /tmp/ldapplugin
svn co http://trac-hacks.org/svn/ldapplugin/0.10/
tree -L 2
.
|-- 0.10
|   |-- AUTHORS
|   |-- COPYING
|   |-- ldapplugin
|   |-- setup.cfg
|   `-- setup.py
`-- index.html

 Al termine dello scaricamento, seguo la procedura di installazione che vale per ogni plugin (e che all'inizio non risulta cosi trasparente):

cd 0.10
python setup.py bdist_egg

tree -L 2
.
|-- AUTHORS
|-- COPYING
|-- LdapPlugin.egg-info
|   |-- PKG-INFO
|   |-- SOURCES.txt
|   |-- dependency_links.txt
|   |-- entry_points.txt
|   `-- top_level.txt
|-- build
|   |-- bdist.linux-x86_64
|   `-- lib
|-- dist
|   `-- LdapPlugin-0.5.1dev_r1611-py2.5.egg |-- ldapplugin
|   |-- __init__.py
|   |-- api.py
|   `-- tests
|-- setup.cfg
`-- setup.py

Il processo ha generato il file LdapPlugin-0.5.1dev_r1611-py2.5.egg che è il plugin compilato e che si può installare in due modi: a livello di progetto copiandolo nella directory plugins in /var/www/trac/hello_world/ oppure a livello di sistema con il comando:

cd dist
easy_install LdapPlugin-0.5.1dev_r1611-py2.5.egg

I puristi preferiranno sicuramente il metodo della copia perchè trac non ha un meccanismo di rimozione dei plugin installati e la procedura di rimozione indicata sul sito è tutt'altro che user-friendly.

Ora il plugin va attivato creando questa sezioni in trac.ini

[components] ldapplugin.* = enabled

e va aggiunta la sezione di configurazione per il plugin stesso che sul sito viene riportata cosi:

[ldap]
# enable LDAP support for Trac
enable = false
# enable TLS support
use_tls = false
# LDAP directory host
host = localhost
# LDAP directory port (default port for LDAPS/TLS connections is 636)
port = 389
# BaseDN
basedn = dc=example,dc=com
# Relative DN for users (defaults to none)
user_rdn = 
# Relative DN for group of names (defaults to none)
group_rdn = 
# objectclass for groups
groupname = groupofnames
# dn entry in a groupname 
groupmember = member
# attribute name for a group
groupattr = cn
# attribute name for a user
uidattr = uid
# attribute name to store trac permission
permattr = tracperm
# filter to search for dn with 'permattr' attributes
permfilter = objectclass=*
# time, in seconds, before a cached entry is purged out of the local cache.
cache_ttl = 900
# maximum number of entries in the cache
cache_size = 100
# whether to perform an authenticated bind for group resolution
group_bind = false
# whether to perform an authenticated bind for permision store operations
store_bind = false
# user for authenticated connection to the LDAP directory
bind_user = 
# password for authenticated connection
bind_passwd =
# global permissions (vs. per-environment permissions)
global_perms = false
# group permissions are managed as addition/removal to the LDAP directory groups
manage_groups = true
# whether a group member contains the full dn or a simple uid
groupmemberisdn = true
# domain name of LDAP server
host = localhost

 

B2) Modifiche alla struttura ldap

La sezione [ldap] deve essere configurata sulla base della struttura data ad ldap. Nel mio caso ho previsto un ou=g_svn nel quale vado a definire i gruppi e per ciascun gruppo enumero nell'attributo multiplo memberUid il DN degli utenti (contenuti nella ou=users) che appartengono a tale gruppo. L'idea è quella di sfuttare l'ou=g_svn sia per trac che per svn non appena sarò riuscito a modificare lo script di cui parlavo nel post precedente.

Questa è la struttura ldap che ho utilizzato:

dn: ou=g_svn,dc=example,dc=com
objectClass: organizationalUnit
objectClass: top
ou: g_svn

dn: cn=administrator,dc=example,dc=com
objectClass: posixGroup
objectClass: top
objectClass: tracgroup
cn: administrator
gidNumber: 1002
tracperm: test:TRAC_ADMIN
memberUid: uid=dam,ou=users,dc=example,dc=com

dn: cn=not_authenticated,ou=g_svn,dc=example,dc=com
objectClass: posixGroup
objectClass: top
objectClass: tracgroup
cn: not_authenticated
gidNumber: 1007
memberUid: uid=anonymous,ou=users,dc=example,dc=com
tracperm: test:WIKI_VIEW

che in phpldapadmin viene cosi rappresentata

C'è una cosa importante da considerare: prendiamo l'utente dam. Ammettiamo che faccia parte del gruppo administrator come nell'esempio. La domanda da porsi è: "dam sarà amministratore per tutti i progetti svn? indistintamente? per sempre". In genere è difficile fare previsioni cosi assolute e cosi a lungo termine (life sucks :-D) quindi è necessaria una certa flessibilità.

Quelli di trac, che sono in gamba, ci hanno pensato e hanno definito l'attributo tracperm nel quale trac deve poter scrivere per salvare i diritti d'accesso per ciascun gruppo e ciascun progetto nella forma: PROGETTO:RUOLO (hello_world:TRAC_ADMIN)

Mi sono discostato un po dalla guida ed ho scritto uno schema ausiliario per l'objectClass TOP. Lo schema va incluso nel file di configurazione slapd.conf come al solito.

 cat /etc/ldap/schema/tracuser.schema

# 1.3.6.1.4.1.15527 is reserved. Do not hijack it
# Please see http://www.iana.org/cgi-bin/enterprise.pl

# Attribute type definitions
attributetype ( 1.3.6.1.4.1.15527.143
        NAME 'tracperm'
        DESC 'Trac Permission'
        EQUALITY caseIgnoreMatch
        SUBSTR caseIgnoreSubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32} )

# Class definitions
objectclass ( 1.3.6.1.4.1.15527.8
        NAME 'tracuser'
        DESC 'Regular user with Trac permission'
        SUP top
        AUXILIARY
        MUST ( uid $ cn $ userpassword )
        MAY  ( tracperm $ sn $ description ) )

objectclass ( 1.3.6.1.4.1.15527.9
        NAME 'tracgroup'
        DESC 'Trac permission for groupofnames'
        SUP top
        AUXILIARY
        MAY  ( tracperm ) )

Ldap va riavviato

 

B3) Configurare trac per operare su ldap

Questa è la configurazione finale della sezione [ldap] di trac.ini

[ldap] basedn = dc=example,dc=com
bind_passwd = YOUR_PASSWORD_HERE
bind_user = cn=admin,dc=example,dc=com
cache_size = 100
cache_ttl = 900
enable = true
global_perms = false
group_bind = true
group_rdn = ou=g_svn
groupattr = cn
groupmember = memberUid
groupmemberisdn = true
groupname = posixGroup
host = localhost
manage_groups = true
permattr = tracperm
permfilter = objectclass=tracuser
port = 389
store_bind = true
uidattr = uid
use_tls = false
user_rdn = ou=users

 

B4) Scrittura acl per trac

Reference: manuale ufficiale

Per il percorso che ho fatto il manuale è un po' fuorviante perchè spiega a partire dalla interfaccia grafica (web) che invece io non ho usato perchè mi sembra troppo complicata.

Quello che va saputo sin da subito è che trac prevede un set di utente base e un set di diritti precostituiti che regolamentano ciascuna delle sue componenti, wiki, ticket ...

Gli utenti base sono: anonymous e authenticated . Di questi due utenti almeno l'anonymous deve esistere come entry in ldap ed equivale al profilo dell'utente che, navigando, arriva sul sito.

Riporto per completezza il set di diritti precostituiti:

Repository Browser

BROWSER_VIEW View directory listings in the repository browser
LOG_VIEW View revision logs of files and directories in the repository browser
FILE_VIEW View files in the repository browser
CHANGESET_VIEW View repository check-ins

Ticket System

TICKET_VIEW View existing tickets and perform ticket queries
TICKET_CREATE Create new tickets
TICKET_APPEND Add comments or attachments to tickets
TICKET_CHGPROP Modify ticket properties (priority, assignment, keywords, etc.) except description field, cc field add/remove when logged in or set email to pref
TICKET_MODIFY Includes both TICKET_APPEND and TICKET_CHGPROP, and in addition allows resolving tickets
TICKET_EDIT_CC Full modify cc field
TICKET_EDIT_DESCRIPTION Modify description field
TICKET_ADMIN All TICKET_* permissions, plus the deletion of ticket attachments and modification of the description field

Attention: the "view tickets" button appears with the REPORT_VIEW permission.

Roadmap

MILESTONE_VIEW View a milestone
MILESTONE_CREATE Create a new milestone
MILESTONE_MODIFY Modify existing milestones
MILESTONE_DELETE Delete milestones
MILESTONE_ADMIN All MILESTONE_* permissions
ROADMAP_VIEW View the roadmap page, is not (yet) the same as MILESTONE_VIEW
ROADMAP_ADMIN replaced by MILESTONE_ADMIN

Reports

REPORT_VIEW View reports, i.e. the "view tickets" link.
REPORT_SQL_VIEW View the underlying SQL query of a report
REPORT_CREATE Create new reports
REPORT_MODIFY Modify existing reports
REPORT_DELETE Delete reports
REPORT_ADMIN All REPORT_* permissions

Wiki System

WIKI_VIEW View existing wiki pages
WIKI_CREATE Create new wiki pages
WIKI_MODIFY Change wiki pages
WIKI_DELETE Delete wiki pages and attachments
WIKI_ADMIN All WIKI_* permissions, plus the management of readonly pages.

Permissions

PERMISSION_GRANT add/grant a permission
PERMISSION_REVOKE remove/revoke a permission
PERMISSION_ADMIN All PERMISSION_* permissions

Others

TIMELINE_VIEW View the timeline page
SEARCH_VIEW View and execute search queries
CONFIG_VIEW Enables additional pages on About Trac that show the current configuration or the list of installed plugins
EMAIL_VIEW Shows email addresses even if trac show_email_addresses configuration option is false

a cui va aggiunto TRAC_ADMIN che equivale al gruppo ROOT

 

Per gestire i diritti si usa trac-admin da console, ma va tenuto presente che trac non può creare entry nè a livello di utente nè a livello di gruppo. Quindi l'utente anymous, dam e i gruppi administrator e not_authenticated devono gia esistere in ldap prima di usare trac-admin.

Associo l'utente dam al gruppo administator:

trac-admin /var/www/trac/hello_world permission add dam @administrator

Associo l'utente anonymous al gruppo not_authenticated:

trac-admin /var/www/trac/hello_world permission add anonymous @not_authenticated

Do i diritti di root al gruppo administrator

trac-admin /var/www/trac/hello_world permission add @administrator TRAC_ADMIN

Do i diritti di lettura al wiki al gruppo not_authenticated

trac-admin /var/www/trac/hello_world permission add @not_authenticated WIKI_VIEW

Ora verifico i permessi che ho dato:

trac-admin /var/www/trac/hello_world permission list
User       Action       
-------------------------
anonymous  @not_authenticated
dam        @administrator 

Available actions:
 BROWSER_VIEW, CHANGESET_VIEW, CONFIG_VIEW, EMAIL_VIEW, FILE_VIEW,
 LOG_VIEW, MILESTONE_ADMIN, MILESTONE_CREATE, MILESTONE_DELETE,
 MILESTONE_MODIFY, MILESTONE_VIEW, PERMISSION_ADMIN, PERMISSION_GRANT,
 PERMISSION_REVOKE, ROADMAP_ADMIN, ROADMAP_VIEW, SEARCH_VIEW, SPAM_ADMIN,
 SPAM_CONFIG, SPAM_MONITOR, SPAM_TRAIN, TICKET_ADMIN, TICKET_APPEND,
 TICKET_CHGPROP, TICKET_CREATE, TICKET_EDIT_CC, TICKET_EDIT_DESCRIPTION,
 TICKET_MODIFY, TICKET_VIEW, TIMELINE_VIEW, TRAC_ADMIN, WIKI_ADMIN,
 WIKI_CREATE, WIKI_DELETE, WIKI_MODIFY, WIKI_VIEW, XML_RPC

Ora verifico quali diritti hanno i membri del gruppo @not_authenticated

trac-admin /var/www/trac/hello_world permission list @not_authenticated
User                Action  
-----------------------------
@not_authenticated  WIKI_VIEW

Lo stesso per gli administrator:

trac-admin /var/www/trac/hello_world permission list @administrator
User            Action                
---------------------------------------
@administrator  BROWSER_VIEW          
@administrator  CHANGESET_VIEW        
@administrator  CONFIG_VIEW           
@administrator  EMAIL_VIEW            
@administrator  FILE_VIEW             
@administrator  LOG_VIEW              
@administrator  MILESTONE_ADMIN       
@administrator  MILESTONE_CREATE      
@administrator  MILESTONE_DELETE      
@administrator  MILESTONE_MODIFY      
@administrator  MILESTONE_VIEW        
@administrator  PERMISSION_ADMIN      
@administrator  PERMISSION_GRANT      
@administrator  PERMISSION_REVOKE     
@administrator  ROADMAP_ADMIN         
@administrator  ROADMAP_VIEW          
@administrator  SEARCH_VIEW           
@administrator  SPAM_ADMIN            
@administrator  SPAM_CONFIG           
@administrator  SPAM_MONITOR          
@administrator  SPAM_TRAIN            
@administrator  TICKET_ADMIN          
@administrator  TICKET_APPEND         
@administrator  TICKET_CHGPROP        
@administrator  TICKET_CREATE         
@administrator  TICKET_EDIT_CC        
@administrator  TICKET_EDIT_DESCRIPTION
@administrator  TICKET_MODIFY         
@administrator  TICKET_VIEW           
@administrator  TIMELINE_VIEW         
@administrator  TRAC_ADMIN            
@administrator  WIKI_ADMIN            
@administrator  WIKI_CREATE           
@administrator  WIKI_DELETE           
@administrator  WIKI_MODIFY           
@administrator  WIKI_VIEW    

Al momento attuale un utente non autenticato potrebbe vedere eclusivamente la sezione wiki del sito, quindi vedrà questo:

 

Se invece dovesse comparire questo messaggio di errore:

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/trac/web/api.py", line 339, in send_error
    'text/html')
  File "/usr/lib/python2.5/site-packages/trac/web/chrome.py", line 684, in render_template
    data = self.populate_data(req, data)
  File "/usr/lib/python2.5/site-packages/trac/web/chrome.py", line 592, in populate_data
    d['chrome'].update(req.chrome)
  File "/usr/lib/python2.5/site-packages/trac/web/api.py", line 169, in __getattr__
    value = self.callbacks[name](self)
  File "/usr/lib/python2.5/site-packages/trac/web/chrome.py", line 460, in prepare_request
    for category, name, text in contributor.get_navigation_items(req):
  File "/usr/lib/python2.5/site-packages/trac/ticket/query.py", line 734, in get_navigation_items
    if 'TICKET_VIEW' in req.perm and \
  File "/usr/lib/python2.5/site-packages/trac/perm.py", line 523, in has_permission
    return self._has_permission(action, resource)
  File "/usr/lib/python2.5/site-packages/trac/perm.py", line 537, in _has_permission
    check_permission(action, perm.username, resource, perm)
  File "/usr/lib/python2.5/site-packages/trac/perm.py", line 424, in check_permission
    perm)
  File "/usr/lib/python2.5/site-packages/trac/perm.py", line 282, in check_permission
    get_user_permissions(username)
  File "/usr/lib/python2.5/site-packages/trac/perm.py", line 357, in get_user_permissions
    for perm in self.store.get_user_permissions(username):
  File "/usr/lib/python2.5/site-packages/trac/config.py", line 466, in __get__
    self.section, self.name))
AttributeError: Cannot find an implementation of the "IPermissionStore" interface named "LdapPermissionStore".  Please update the option trac.permission_store in trac.ini.

significa che si è incaprettata l'installazione del modulo e conviene ripetere l'installazione del modulo.

Se invece dovesse comparire questo messaggio

Trac Error
TracError: The Trac Environment needs to be upgraded.
Run "trac-admin /var/www/trac/hello_world upgrade"

è tutto ok, basta lanciare il comando in grassetto in un terminale

 

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
7 + 9 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.