diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-14 11:34:08 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-14 11:34:08 +0000 |
commit | 21c97c6a1376a38a3951c57069317c17c81029f8 (patch) | |
tree | 8d38f129585767d4c1eb2c78d0b9b978aff14d70 /lib/redmine.rb | |
parent | 29348fafb7ca43cb00ef80f29e61167647df0cd8 (diff) | |
download | redmine-21c97c6a1376a38a3951c57069317c17c81029f8.tar.gz redmine-21c97c6a1376a38a3951c57069317c17c81029f8.zip |
Added project module concept.
A project module (eg. issue tracking, news, wiki,...) is a set of permissions that can enabled/disabled at project level.
For each project, modules can be enabled on the project settings view ('Modules' tab).
This requires a specific permission: 'Select project modules' (if this permission is turned off, only Redmine administrators can choose which modules a project uses).
When applying this migration, all modules are enabled for all existing projects.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@725 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine.rb')
-rw-r--r-- | lib/redmine.rb | 113 |
1 files changed, 66 insertions, 47 deletions
diff --git a/lib/redmine.rb b/lib/redmine.rb index a0da981e4..9392558f5 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -14,57 +14,76 @@ REDMINE_SUPPORTED_SCM = %w( Subversion Darcs Mercurial Cvs ) # Permissions Redmine::AccessControl.map do |map| - # Project - map.permission :view_project, {:projects => [:show, :activity, :changelog, :roadmap, :feeds]}, :public => true + map.permission :view_project, {:projects => [:show, :activity, :feeds]}, :public => true map.permission :search_project, {:search => :index}, :public => true map.permission :edit_project, {:projects => [:settings, :edit]}, :require => :member - map.permission :manage_members, {:projects => [:settings, :add_member], :members => [:edit, :destroy]}, :require => :member + map.permission :select_project_modules, {:projects => :modules}, :require => :member + map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy]}, :require => :member map.permission :manage_versions, {:projects => [:settings, :add_version], :versions => [:edit, :destroy]}, :require => :member - map.permission :manage_categories, {:projects => [:settings, :add_issue_category], :issue_categories => [:edit, :destroy]}, :require => :member - # Issues - map.permission :view_issues, {:projects => [:list_issues, :export_issues_csv, :export_issues_pdf], - :issues => [:show, :export_pdf], - :queries => :index, - :reports => :issue_report}, :public => true - map.permission :add_issues, {:projects => :add_issue}, :require => :loggedin - map.permission :edit_issues, {:issues => [:edit, :destroy_attachment]}, :require => :loggedin - map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}, :require => :loggedin - map.permission :add_issue_notes, {:issues => :add_note}, :require => :loggedin - map.permission :change_issue_status, {:issues => :change_status}, :require => :loggedin - map.permission :move_issues, {:projects => :move_issues}, :require => :loggedin - map.permission :delete_issues, {:issues => :destroy}, :require => :member - # Queries - map.permission :manage_pulic_queries, {:queries => [:new, :edit, :destroy]}, :require => :member - map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin - # Gantt & calendar - map.permission :view_gantt, :projects => :gantt - map.permission :view_calendar, :projects => :calendar - # Time tracking - map.permission :log_time, {:timelog => :edit}, :require => :loggedin - map.permission :view_time_entries, :timelog => [:details, :report] - # News - map.permission :view_news, {:projects => :list_news, :news => :show}, :public => true - map.permission :manage_news, {:projects => :add_news, :news => [:edit, :destroy, :destroy_comment]}, :require => :member - map.permission :comment_news, {:news => :add_comment}, :require => :loggedin - # Documents - map.permission :view_documents, :projects => :list_documents, :documents => [:show, :download] - map.permission :manage_documents, {:projects => :add_document, :documents => [:edit, :destroy, :add_attachment, :destroy_attachment]}, :require => :loggedin - # Wiki - map.permission :view_wiki_pages, :wiki => [:index, :history, :diff, :special] - map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment, :destroy_attachment] - map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member - map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member - # Message boards - map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true - map.permission :add_messages, {:messages => [:new, :reply]}, :require => :loggedin - map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member - # Files - map.permission :view_files, :projects => :list_files, :versions => :download - map.permission :manage_files, {:projects => :add_file, :versions => :destroy_file}, :require => :loggedin - # Repository - map.permission :browse_repository, :repositories => [:show, :browse, :entry, :changes, :diff, :stats, :graph] - map.permission :view_changesets, :repositories => [:show, :revisions, :revision] + map.project_module :issue_tracking do |map| + # Issue categories + map.permission :manage_categories, {:projects => [:settings, :add_issue_category], :issue_categories => [:edit, :destroy]}, :require => :member + # Issues + map.permission :view_issues, {:projects => [:list_issues, :export_issues_csv, :export_issues_pdf, :changelog, :roadmap], + :issues => [:show, :export_pdf], + :queries => :index, + :reports => :issue_report}, :public => true + map.permission :add_issues, {:projects => :add_issue}, :require => :loggedin + map.permission :edit_issues, {:issues => [:edit, :destroy_attachment]}, :require => :loggedin + map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}, :require => :loggedin + map.permission :add_issue_notes, {:issues => :add_note}, :require => :loggedin + map.permission :change_issue_status, {:issues => :change_status}, :require => :loggedin + map.permission :move_issues, {:projects => :move_issues}, :require => :loggedin + map.permission :delete_issues, {:issues => :destroy}, :require => :member + # Queries + map.permission :manage_pulic_queries, {:queries => [:new, :edit, :destroy]}, :require => :member + map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin + # Gantt & calendar + map.permission :view_gantt, :projects => :gantt + map.permission :view_calendar, :projects => :calendar + end + + map.project_module :time_tracking do |map| + map.permission :log_time, {:timelog => :edit}, :require => :loggedin + map.permission :view_time_entries, :timelog => [:details, :report] + end + + map.project_module :news do |map| + map.permission :manage_news, {:projects => :add_news, :news => [:edit, :destroy, :destroy_comment]}, :require => :member + map.permission :view_news, {:projects => :list_news, :news => :show}, :public => true + map.permission :comment_news, {:news => :add_comment}, :require => :loggedin + end + + map.project_module :documents do |map| + map.permission :manage_documents, {:projects => :add_document, :documents => [:edit, :destroy, :add_attachment, :destroy_attachment]}, :require => :loggedin + map.permission :view_documents, :projects => :list_documents, :documents => [:show, :download] + end + + map.project_module :files do |map| + map.permission :manage_files, {:projects => :add_file, :versions => :destroy_file}, :require => :loggedin + map.permission :view_files, :projects => :list_files, :versions => :download + end + + map.project_module :wiki do |map| + map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member + map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member + map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member + map.permission :view_wiki_pages, :wiki => [:index, :history, :diff, :special] + map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment, :destroy_attachment] + end + + map.project_module :repository do |map| + map.permission :manage_repository, :repositories => [:edit, :destroy] + map.permission :browse_repository, :repositories => [:show, :browse, :entry, :changes, :diff, :stats, :graph] + map.permission :view_changesets, :repositories => [:show, :revisions, :revision] + end + + map.project_module :boards do |map| + map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member + map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true + map.permission :add_messages, {:messages => [:new, :reply]}, :require => :loggedin + end end # Project menu configuration |