2007-08-29 20:52:35 +04:00
|
|
|
require 'redmine/access_control'
|
|
|
|
require 'redmine/menu_manager'
|
2008-07-27 21:54:09 +04:00
|
|
|
require 'redmine/activity'
|
2007-05-08 19:49:20 +04:00
|
|
|
require 'redmine/mime_type'
|
2008-04-26 15:59:51 +04:00
|
|
|
require 'redmine/core_ext'
|
2007-10-10 21:17:37 +04:00
|
|
|
require 'redmine/themes'
|
2008-09-05 14:31:06 +04:00
|
|
|
require 'redmine/hook'
|
2007-09-23 21:19:27 +04:00
|
|
|
require 'redmine/plugin'
|
2008-10-27 14:08:29 +03:00
|
|
|
require 'redmine/wiki_formatting'
|
2007-06-13 00:12:05 +04:00
|
|
|
|
2007-08-26 11:55:57 +04:00
|
|
|
begin
|
2007-09-17 20:56:11 +04:00
|
|
|
require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick)
|
2007-08-26 11:55:57 +04:00
|
|
|
rescue LoadError
|
|
|
|
# RMagick is not available
|
|
|
|
end
|
|
|
|
|
2009-11-04 16:22:26 +03:00
|
|
|
if RUBY_VERSION < '1.9'
|
|
|
|
require 'faster_csv'
|
|
|
|
else
|
|
|
|
require 'csv'
|
|
|
|
FCSV = CSV
|
|
|
|
end
|
|
|
|
|
2008-06-08 19:40:24 +04:00
|
|
|
REDMINE_SUPPORTED_SCM = %w( Subversion Darcs Mercurial Cvs Bazaar Git Filesystem )
|
2007-08-29 20:52:35 +04:00
|
|
|
|
|
|
|
# Permissions
|
|
|
|
Redmine::AccessControl.map do |map|
|
2007-10-01 17:13:04 +04:00
|
|
|
map.permission :view_project, {:projects => [:show, :activity]}, :public => true
|
2007-08-29 20:52:35 +04:00
|
|
|
map.permission :search_project, {:search => :index}, :public => true
|
2009-05-17 16:59:14 +04:00
|
|
|
map.permission :add_project, {:projects => :add}, :require => :loggedin
|
2007-08-29 20:52:35 +04:00
|
|
|
map.permission :edit_project, {:projects => [:settings, :edit]}, :require => :member
|
2007-09-14 15:34:08 +04:00
|
|
|
map.permission :select_project_modules, {:projects => :modules}, :require => :member
|
2009-09-12 12:36:46 +04:00
|
|
|
map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member
|
2009-11-09 21:53:12 +03:00
|
|
|
map.permission :manage_versions, {:projects => [:settings, :add_version], :versions => [:edit, :close_completed, :destroy]}, :require => :member
|
2007-08-29 20:52:35 +04:00
|
|
|
|
2007-09-14 15:34:08 +04:00
|
|
|
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
|
2007-11-05 21:38:42 +03:00
|
|
|
map.permission :view_issues, {:projects => [:changelog, :roadmap],
|
|
|
|
:issues => [:index, :changes, :show, :context_menu],
|
2007-12-07 13:26:07 +03:00
|
|
|
:versions => [:show, :status_by],
|
2007-09-14 15:34:08 +04:00
|
|
|
:queries => :index,
|
2009-11-14 15:08:47 +03:00
|
|
|
:reports => :issue_report}
|
2009-11-29 22:46:40 +03:00
|
|
|
map.permission :add_issues, {:issues => [:new, :update_form]}
|
|
|
|
map.permission :edit_issues, {:issues => [:edit, :reply, :bulk_edit, :update_form]}
|
2007-11-20 18:40:16 +03:00
|
|
|
map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}
|
2008-05-30 21:42:25 +04:00
|
|
|
map.permission :add_issue_notes, {:issues => [:edit, :reply]}
|
2008-02-16 16:19:33 +03:00
|
|
|
map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin
|
|
|
|
map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin
|
2008-02-10 16:17:41 +03:00
|
|
|
map.permission :move_issues, {:issues => :move}, :require => :loggedin
|
2007-09-14 15:34:08 +04:00
|
|
|
map.permission :delete_issues, {:issues => :destroy}, :require => :member
|
|
|
|
# Queries
|
2007-09-30 19:32:03 +04:00
|
|
|
map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member
|
2007-09-14 15:34:08 +04:00
|
|
|
map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin
|
|
|
|
# Gantt & calendar
|
2008-09-10 22:26:13 +04:00
|
|
|
map.permission :view_gantt, :issues => :gantt
|
2008-09-11 21:03:26 +04:00
|
|
|
map.permission :view_calendar, :issues => :calendar
|
2008-08-03 13:14:43 +04:00
|
|
|
# Watchers
|
|
|
|
map.permission :view_issue_watchers, {}
|
|
|
|
map.permission :add_issue_watchers, {:watchers => :new}
|
2009-10-25 15:11:53 +03:00
|
|
|
map.permission :delete_issue_watchers, {:watchers => :destroy}
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
map.project_module :time_tracking do |map|
|
|
|
|
map.permission :log_time, {:timelog => :edit}, :require => :loggedin
|
|
|
|
map.permission :view_time_entries, :timelog => [:details, :report]
|
2008-03-15 00:17:09 +03:00
|
|
|
map.permission :edit_time_entries, {:timelog => [:edit, :destroy]}, :require => :member
|
|
|
|
map.permission :edit_own_time_entries, {:timelog => [:edit, :destroy]}, :require => :loggedin
|
2009-10-22 02:34:45 +04:00
|
|
|
map.permission :manage_project_activities, {:projects => [:save_activities, :reset_activities]}, :require => :member
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
map.project_module :news do |map|
|
2008-02-03 17:38:04 +03:00
|
|
|
map.permission :manage_news, {:news => [:new, :edit, :destroy, :destroy_comment]}, :require => :member
|
2007-11-06 01:22:51 +03:00
|
|
|
map.permission :view_news, {:news => [:index, :show]}, :public => true
|
2007-11-20 18:40:16 +03:00
|
|
|
map.permission :comment_news, {:news => :add_comment}
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
map.project_module :documents do |map|
|
2008-12-09 19:54:46 +03:00
|
|
|
map.permission :manage_documents, {:documents => [:new, :edit, :destroy, :add_attachment]}, :require => :loggedin
|
2007-12-18 21:50:41 +03:00
|
|
|
map.permission :view_documents, :documents => [:index, :show, :download]
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
map.project_module :files do |map|
|
2008-12-09 19:54:46 +03:00
|
|
|
map.permission :manage_files, {:projects => :add_file}, :require => :loggedin
|
2007-09-14 15:34:08 +04:00
|
|
|
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
|
2008-09-13 20:45:01 +04:00
|
|
|
map.permission :view_wiki_pages, :wiki => [:index, :special]
|
|
|
|
map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate]
|
2008-10-18 14:07:49 +04:00
|
|
|
map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment]
|
2008-12-09 19:54:46 +03:00
|
|
|
map.permission :delete_wiki_pages_attachments, {}
|
2008-05-04 19:05:38 +04:00
|
|
|
map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
map.project_module :repository do |map|
|
2008-11-10 21:59:06 +03:00
|
|
|
map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member
|
2007-12-02 23:58:02 +03:00
|
|
|
map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph]
|
2007-09-14 15:34:08 +04:00
|
|
|
map.permission :view_changesets, :repositories => [:show, :revisions, :revision]
|
2008-09-13 20:31:11 +04:00
|
|
|
map.permission :commit_access, {}
|
2007-09-14 15:34:08 +04:00
|
|
|
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
|
2008-08-28 22:56:47 +04:00
|
|
|
map.permission :add_messages, {:messages => [:new, :reply, :quote]}
|
2007-11-24 15:25:07 +03:00
|
|
|
map.permission :edit_messages, {:messages => :edit}, :require => :member
|
2008-11-11 18:07:55 +03:00
|
|
|
map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin
|
2007-11-24 15:25:07 +03:00
|
|
|
map.permission :delete_messages, {:messages => :destroy}, :require => :member
|
2008-11-11 18:07:55 +03:00
|
|
|
map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
2007-08-29 20:52:35 +04:00
|
|
|
end
|
|
|
|
|
2008-02-12 20:58:46 +03:00
|
|
|
Redmine::MenuManager.map :top_menu do |menu|
|
2008-11-27 21:04:48 +03:00
|
|
|
menu.push :home, :home_path
|
|
|
|
menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? }
|
|
|
|
menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural
|
|
|
|
menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true
|
|
|
|
menu.push :help, Redmine::Info.help_url, :last => true
|
2008-02-12 20:58:46 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
Redmine::MenuManager.map :account_menu do |menu|
|
2008-11-27 21:04:48 +03:00
|
|
|
menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? }
|
|
|
|
menu.push :register, { :controller => 'account', :action => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? }
|
|
|
|
menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? }
|
|
|
|
menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? }
|
2008-02-12 20:58:46 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
Redmine::MenuManager.map :application_menu do |menu|
|
|
|
|
# Empty
|
|
|
|
end
|
|
|
|
|
2008-11-11 21:10:21 +03:00
|
|
|
Redmine::MenuManager.map :admin_menu do |menu|
|
|
|
|
# Empty
|
|
|
|
end
|
|
|
|
|
2007-08-29 20:52:35 +04:00
|
|
|
Redmine::MenuManager.map :project_menu do |menu|
|
2008-02-12 20:58:46 +03:00
|
|
|
menu.push :overview, { :controller => 'projects', :action => 'show' }
|
|
|
|
menu.push :activity, { :controller => 'projects', :action => 'activity' }
|
2008-02-02 14:08:04 +03:00
|
|
|
menu.push :roadmap, { :controller => 'projects', :action => 'roadmap' },
|
2009-12-06 13:28:20 +03:00
|
|
|
:if => Proc.new { |p| p.shared_versions.any? }
|
2008-01-19 14:53:43 +03:00
|
|
|
menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural
|
2008-01-20 16:07:19 +03:00
|
|
|
menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new,
|
|
|
|
:html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }
|
2008-01-19 14:53:43 +03:00
|
|
|
menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural
|
|
|
|
menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural
|
|
|
|
menu.push :wiki, { :controller => 'wiki', :action => 'index', :page => nil },
|
2008-02-12 20:58:46 +03:00
|
|
|
:if => Proc.new { |p| p.wiki && !p.wiki.new_record? }
|
2008-01-19 14:53:43 +03:00
|
|
|
menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id,
|
|
|
|
:if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural
|
|
|
|
menu.push :files, { :controller => 'projects', :action => 'list_files' }, :caption => :label_attachment_plural
|
|
|
|
menu.push :repository, { :controller => 'repositories', :action => 'show' },
|
2008-02-12 20:58:46 +03:00
|
|
|
:if => Proc.new { |p| p.repository && !p.repository.new_record? }
|
2008-07-13 16:12:58 +04:00
|
|
|
menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true
|
2007-08-29 20:52:35 +04:00
|
|
|
end
|
2008-07-27 21:54:09 +04:00
|
|
|
|
|
|
|
Redmine::Activity.map do |activity|
|
|
|
|
activity.register :issues, :class_name => %w(Issue Journal)
|
|
|
|
activity.register :changesets
|
|
|
|
activity.register :news
|
|
|
|
activity.register :documents, :class_name => %w(Document Attachment)
|
|
|
|
activity.register :files, :class_name => 'Attachment'
|
2008-09-13 20:45:01 +04:00
|
|
|
activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false
|
2008-07-27 21:54:09 +04:00
|
|
|
activity.register :messages, :default => false
|
2009-09-12 14:37:49 +04:00
|
|
|
activity.register :time_entries, :default => false
|
2008-07-27 21:54:09 +04:00
|
|
|
end
|
2008-10-27 14:08:29 +03:00
|
|
|
|
|
|
|
Redmine::WikiFormatting.map do |format|
|
|
|
|
format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper
|
|
|
|
end
|