Ubuntu安装 Trac 插件 – Account Manager Plugin


(一)Apache配置:
如果使用Apache做为Web server,则需要修改Apache的配置,将/login入口的http验证功能取消--移除apache配置文件中的类似如下行的代码:
<LocationMatch "/[^/]+/login">
  AuthType Basic
  AuthName "trac"
  AuthUserFile E:/Trac/passwd.txt
  Require valid-user
</LocationMatch>

最终类似这样的配置在http.conf中

<location /webbase/>
    SetHandler mod_python 
    PythonInterpreter main_interpreter 
    PythonHandler trac.web.modpython_frontend 
    PythonOption TracEnv /var/www/webbase/ 
    PythonOption TracUriRoot /webbase/
    SetEnv PYTHON_EGG_CACHE /var/www/webbase/
</location>

(二)修改trac.ini配置:
  (1)新增组件的支持:
在[components]段中增加:
trac.web.auth.LoginModule = disabled  #禁用传统的登录模块插件
acct_mgr.web_ui.LoginModule = enabled
acct_mgr.web_ui.RegistrationModule = enabled
acct_mgr.htfile.HtPasswdStore = enabled

(2)设置密码表文件:
[account-manager]
password_format = htpasswd
password_store = HtPasswdStore
password_file = /var/www/webbase/conf/.htpasswd  #这里配置密码文件的路径,根据实际情况修改

(3)添加初始用户以及修改目录权限

使用下面的命令添加初始用户

$sudo htpasswd -c /var/www/webbase/conf/.htpasswd user_name

并把密码文件的权限改了,包括所有的网站页面,使用以下命令

$ sudo chown -R root:www-data www
$ sudo chmod -R g+rsw www/

 (4)给添加的用户admin的管理权限

使用下面的命令把用户设为trac-admin权限

trac-admin /path/to/my/project

permission add username-from-htpasswd TRAC_ADMIN

permission list username-from-htpasswd

这样就可以在管理页面对用户进行管理了。

可以使用的配置比对

  1. # -*- coding: utf-8 -*-   
  2. [account-manager]  
  3. account_changes_notify_addresses =   
  4. authentication_url =   
  5. force_passwd_change = true  
  6. generated_password_length = 8  
  7. hash_method = HtDigestHashMethod  
  8. htdigest_realm =   
  9. htpasswd_hash_type = crypt  
  10. password_file = /var/www/webbase/conf/.htpasswd  
  11. password_format = htpasswd  
  12. password_store = HtPasswdStore  
  13. persistent_sessions = False  
  14. user_lock_max_time = 0  
  15. verify_email = False  
  16. [attachment]  
  17. max_size = 262144  
  18. render_unsafe_content = false  
  19. [browser]  
  20. color_scale = True  
  21. downloadable_paths = /trunk, /branches/*, /tags/*  
  22. hide_properties = svk:merge  
  23. intermediate_color =   
  24. intermediate_point =   
  25. newest_color = (255, 136, 136)  
  26. oldest_color = (136, 136, 255)  
  27. oneliner_properties = trac:summary  
  28. render_unsafe_content = false  
  29. wiki_properties = trac:description  
  30. [changeset]  
  31. max_diff_bytes = 10000000  
  32. max_diff_files = 0  
  33. wiki_format_messages = true  
  34. [components]  
  35. acct_mgr.admin.accountguardadminpage = enabled  
  36. acct_mgr.admin.accountmanageradminpage = enabled  
  37. acct_mgr.api.accountmanager = enabled  
  38. acct_mgr.db.sessionstore = enabled  
  39. acct_mgr.guard.accountguard = enabled  
  40. acct_mgr.htfile.abstractpasswordfilestore = enabled  
  41. acct_mgr.htfile.htdigeststore = enabled  
  42. acct_mgr.htfile.htpasswdstore = enabled  
  43. acct_mgr.http.httpauthstore = enabled  
  44. acct_mgr.notification.accountchangelistener = enabled  
  45. acct_mgr.notification.accountchangenotificationadminpanel = enabled  
  46. acct_mgr.pwhash.htdigesthashmethod = enabled  
  47. acct_mgr.pwhash.htpasswdhashmethod = enabled  
  48. acct_mgr.svnserve.svnservepasswordstore = enabled  
  49. acct_mgr.web_ui.accountmodule = enabled  
  50. acct_mgr.web_ui.emailverificationmodule = enabled  
  51. acct_mgr.web_ui.loginmodule = enabled  
  52. acct_mgr.web_ui.registrationmodule = enabled  
  53. iniadmin.iniadmin.iniadminplugin = disabled  
  54. svnauthz.* = enabled  
  55. svnauthz.admin_ui.svnauthzadminpage = enabled  
  56. timingandestimationplugin.api.timetrackingsetupparticipant = enabled  
  57. timingandestimationplugin.hours_layout_changer.hourslayoutchanger = enabled  
  58. timingandestimationplugin.hours_layout_changer.ticketpropslayoutchanger = enabled  
  59. timingandestimationplugin.query_webui.querywebuiaddon = enabled  
  60. timingandestimationplugin.stopwatch.ticketstopwatch = enabled  
  61. timingandestimationplugin.tande_filters.reportsfilter = enabled  
  62. timingandestimationplugin.tande_filters.timeclickfilter = enabled  
  63. timingandestimationplugin.tande_filters.totalhoursfilter = enabled  
  64. timingandestimationplugin.ticket_daemon.timetrackingticketobserver = enabled  
  65. timingandestimationplugin.ticket_daemon.timetrackingticketvalidator = enabled  
  66. timingandestimationplugin.ticket_webui.ticketwebuiaddon = enabled  
  67. timingandestimationplugin.webui.timingestimationandbillingpage = enabled  
  68. trac.web.auth.loginmodule = disabled  
  69. tracopt.perm.authz_policy.authzpolicy = enabled  
  70. tracopt.perm.config_perm_provider.extrapermissionsprovider = enabled  
  71. tracopt.ticket.commit_updater.committicketreferencemacro = enabled  
  72. tracopt.ticket.commit_updater.committicketupdater = enabled  
  73. tracopt.ticket.deleter.ticketdeleter = enabled  
  74. tracwysiwyg.wysiwygmodule = enabled  
  75. webadmin.* = enabled  
  76. webadmin.basics.projectadminpage = enabled  
  77. webadmin.logging.loggingadminpage = enabled  
  78. webadmin.perm.permissionadminpage = enabled  
  79. webadmin.plugin.pluginadminpage = enabled  
  80. webadmin.ticket.componentadminpage = enabled  
  81. webadmin.ticket.milestoneadminpage = enabled  
  82. webadmin.ticket.priorityadminpage = enabled  
  83. webadmin.ticket.severityadminpage = enabled  
  84. webadmin.ticket.tickettypeadminpage = enabled  
  85. webadmin.ticket.versionadminpage = enabled  
  86. webadmin.web_ui.adminmodule = enabled  
  87. [header_logo]  
  88. alt = webbase  
  89. height = 60  
  90. link = http://192.168.6.6/webbase   
  91. src =   
  92. width = 390  
  93. [inherit]  
  94. plugins_dir =   
  95. templates_dir =   
  96. [logging]  
  97. log_file = trac.log  
  98. log_level = DEBUG  
  99. log_type = none  
  100. [milestone]  
  101. stats_provider = DefaultTicketGroupStatsProvider  
  102. [mimeviewer]  
  103. max_preview_size = 262144  
  104. mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb  
  105. pygments_default_style = trac  
  106. pygments_modes =   
  107. tab_width = 8  
  108. treat_as_binary = application/octet-stream,application/pdf,application/postscript,application/msword,application/rtf,  
  109. [notification]  
  110. admit_domains =   
  111. always_notify_owner = false  
  112. always_notify_reporter = false  
  113. always_notify_updater = true  
  114. ambiguous_char_width = single  
  115. email_sender = SmtpEmailSender  
  116. ignore_domains =   
  117. mime_encoding = none  
  118. sendmail_path = sendmail  
  119. smtp_always_bcc =   
  120. smtp_always_cc =   
  121. smtp_default_domain =   
  122. smtp_enabled = false  
  123. smtp_from = trac@localhost  
  124. smtp_from_name =   
  125. smtp_password =   
  126. smtp_port = 25  
  127. smtp_replyto = trac@localhost  
  128. smtp_server = localhost  
  129. smtp_subject_prefix = __default__  
  130. smtp_user =   
  131. ticket_subject_template = $prefix #$ticket.id: $summary  
  132. use_public_cc = false  
  133. use_short_addr = false  
  134. use_tls = false  
  135. [project]  
  136. admin =   
  137. admin_trac_url = .  
  138. descr = webbase平台  
  139. footer = Visit the Trac open source project at<br /><a href="http://trac.edgewall.org/" mce_href="http://trac.edgewall.org/">http://trac.edgewall.org/</a>  
  140. icon = common/trac.ico  
  141. name = webbase  
  142. url =   
  143. [query]  
  144. default_anonymous_query = status!=closed&cc~=$USER  
  145. default_query = status!=closed&owner=$USER  
  146. items_per_page = 100  
  147. ticketlink_query = ?status=!closed  
  148. [report]  
  149. items_per_page = 100  
  150. items_per_page_rss = 0  
  151. [revisionlog]  
  152. default_log_limit = 100  
  153. [roadmap]  
  154. stats_provider = DefaultTicketGroupStatsProvider  
  155. [search]  
  156. min_query_length = 3  
  157. [svn]  
  158. branches = trunk,branches/*  
  159. tags = tags/*  
  160. [svnauthzadmin]  
  161. show_all_repos = true  
  162. [ticket]  
  163. default_cc =   
  164. default_component = webkit/*  
  165. default_description =   
  166. default_keywords =   
  167. default_milestone = 3/19/11  
  168. default_owner =   
  169. default_priority = major  
  170. default_resolution = fixed  
  171. default_severity =   
  172. default_summary =   
  173. default_type = task  
  174. default_version =   
  175. max_comment_size = 262144  
  176. max_description_size = 262144  
  177. preserve_newlines = default  
  178. restrict_owner = false  
  179. workflow = ConfigurableTicketWorkflow  
  180. [ticket-custom]  
  181. billable = checkbox  
  182. billable.label = Billable?  
  183. billable.order = 3  
  184. billable.value = 1  
  185. estimatedhours = text  
  186. estimatedhours.label = Estimated Number of Hours  
  187. estimatedhours.order = 1  
  188. estimatedhours.value = 0  
  189. hours = text  
  190. hours.label = Add Hours to Ticket  
  191. hours.order = 2  
  192. hours.value = 0  
  193. totalhours = text  
  194. totalhours.label = Total Hours  
  195. totalhours.order = 4  
  196. totalhours.value = 0  
  197. [ticket-workflow]  
  198. accept = new,assigned,accepted,reopened -> accepted  
  199. accept.operations = set_owner_to_self  
  200. accept.permissions = TICKET_MODIFY  
  201. leave = * -> *  
  202. leave.default = 1  
  203. leave.operations = leave_status  
  204. reassign = new,assigned,accepted,reopened -> assigned  
  205. reassign.operations = set_owner  
  206. reassign.permissions = TICKET_MODIFY  
  207. reopen = closed -> reopened  
  208. reopen.operations = del_resolution  
  209. reopen.permissions = TICKET_CREATE  
  210. resolve = new,assigned,accepted,reopened -> closed  
  211. resolve.operations = set_resolution  
  212. resolve.permissions = TICKET_MODIFY  
  213. [timeline]  
  214. abbreviated_messages = True  
  215. changeset_collapse_events = false  
  216. changeset_long_messages = false  
  217. changeset_show_files = 0  
  218. default_daysback = 30  
  219. max_daysback = 90  
  220. newticket_formatter = oneliner  
  221. ticket_show_details = false  
  222. [trac]  
  223. auth_cookie_lifetime = 0  
  224. auth_cookie_path =   
  225. authz_file = /opt/svn/webbase/conf/passwd  
  226. authz_module_name = webbase  
  227. auto_preview_timeout = 2.0  
  228. auto_reload = False  
  229. backup_dir = db  
  230. base_url =   
  231. check_auth_ip = false  
  232. database = sqlite:db/trac.db  
  233. debug_sql = False  
  234. default_charset = utf-8  
  235. default_handler = WikiModule  
  236. default_language = gb2312  
  237. default_timezone =   
  238. genshi_cache_size = 128  
  239. htdocs_location =   
  240. ignore_auth_case = false  
  241. mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search  
  242. metanav = login,logout,prefs,help,about  
  243. mysqldump_path = mysqldump  
  244. never_obfuscate_mailto = false  
  245. permission_policies = DefaultPermissionPolicy, LegacyAttachmentPolicy  
  246. permission_store = DefaultPermissionStore  
  247. pg_dump_path = pg_dump  
  248. repository_dir =   
  249. repository_sync_per_request = (default)  
  250. repository_type = svn  
  251. resizable_textareas = true  
  252. secure_cookies = False  
  253. show_email_addresses = false  
  254. show_ip_addresses = false  
  255. timeout = 20  
  256. use_base_url_for_redirect = False  
  257. [versioncontrol]  
  258. allowed_repository_dir_prefixes =   
  259. [wiki]  
  260. ignore_missing_pages = false  
  261. max_size = 262144  
  262. render_unsafe_content = false  
  263. safe_schemes = cvs,file,ftp,git,irc,http,https,news,sftp,smb,ssh,svn,svn+ssh  
  264. split_page_names = false  

相关内容