OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/redmine.rb

393 lines
22 KiB

#-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2014 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
require 'redmine/access_control'
require 'redmine/menu_manager'
require 'redmine/activity'
require 'redmine/search'
require 'redmine/custom_field_format'
require 'redmine/mime_type'
require 'redmine/core_ext'
require 'open_project/themes'
require 'redmine/hook'
require 'open_project/hooks'
require 'redmine/plugin'
require 'redmine/notifiable'
require 'redmine/wiki_formatting'
require 'redmine/scm/base'
require 'csv'
require 'globalize'
Redmine::Scm::Base.add "Subversion"
Redmine::Scm::Base.add "Git"
Redmine::Scm::Base.add "Filesystem"
Redmine::CustomFieldFormat.map do |fields|
fields.register Redmine::CustomFieldFormat.new('string', :label => :label_string, :order => 1)
fields.register Redmine::CustomFieldFormat.new('text', :label => :label_text, :order => 2)
fields.register Redmine::CustomFieldFormat.new('int', :label => :label_integer, :order => 3)
fields.register Redmine::CustomFieldFormat.new('float', :label => :label_float, :order => 4)
fields.register Redmine::CustomFieldFormat.new('list', :label => :label_list, :order => 5)
fields.register Redmine::CustomFieldFormat.new('date', :label => :label_date, :order => 6)
fields.register Redmine::CustomFieldFormat.new('bool', :label => :label_boolean, :order => 7)
fields.register Redmine::CustomFieldFormat.new('user', :label => Proc.new { User.model_name.human }, :only => %w(WorkPackage TimeEntry Version Project), :edit_as => 'list', :order => 8)
fields.register Redmine::CustomFieldFormat.new('version', :label => Proc.new { Version.model_name.human }, :only => %w(WorkPackage TimeEntry Version Project), :edit_as => 'list', :order => 9)
end
# Permissions
Redmine::AccessControl.map do |map|
map.permission :view_project,
{
:types => [:index, :show],
:projects => [:show],
:projects => [:show],
:activities => [:index]
},
:public => true
map.permission :search_project, {:search => :index}, :public => true
map.permission :add_project, {
:projects => [:new, :create],
:members => [:paginate_users]
}, :require => :loggedin
map.permission :edit_project,
{
:projects => [:settings, :edit, :update],
:members => [:paginate_users]
},
:require => :member
map.permission :select_project_modules, {:projects => :modules}, :require => :member
map.permission :manage_members, {:projects => :settings, :members => [:create, :update, :destroy, :autocomplete_for_member]}, :require => :member
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member
map.permission :manage_types, {:projects => :types}, :require => :member
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member
map.permission :copy_projects, {
:copy_projects => [:copy, :copy_project],
:members => [:paginate_users]
}, :require => :member
map.permission :load_column_data, {
:work_packages => [ :column_data ]
}
map.permission :load_column_sums, {
:work_packages => [ :column_sums ]
}
map.project_module :work_package_tracking do |map|
# Issue categories
map.permission :manage_categories, {:projects => :settings, :categories => [:new, :create, :edit, :update, :destroy]}, :require => :member
# Issues
map.permission :view_work_packages, {:'issues' => [:index, :all, :show],
:auto_complete => [:issues],
:versions => [:index, :show, :status_by],
:journals => [:index, :diff],
:queries => [:index, :create, :update, :available_columns, :custom_field_filters, :grouped],
:work_packages => [:show, :index],
Initial foundations for API v3 User Story # 8769 Squashed commit of the following: commit fac82d68b6afa6a757b2ca1b71e7424c02666471 Author: Marek Takac <m.takac@finn.de> Date: Wed Jun 11 15:53:21 2014 +0200 Removed cascade false call from root api commit fedff52220927830376939021d4a36df26dc854b Merge: 7b2942c e204fa9 Author: Marek Takac <m.takac@finn.de> Date: Wed Jun 11 14:17:27 2014 +0200 Merge commit 7b2942c419864448d9416909f73d5aa23c8bea4a Author: Marek Takac <m.takac@finn.de> Date: Wed Jun 11 14:11:58 2014 +0200 Generated new Gemfile.lock commit 7af2f77bbcd4c4871ccccb4211939d6e975fe607 Author: Marek Takac <m.takac@finn.de> Date: Tue Jun 10 15:03:47 2014 +0200 Removed print call commit bb19cddee90b7bd163004f1ed7009af29d8219e7 Author: Marek Takac <m.takac@finn.de> Date: Tue Jun 10 14:39:35 2014 +0200 Removed 'spec/factories/priority_factory.rb commit e8bbf476f148775654fb840e6219b40f955387de Author: Marek Takac <m.takac@finn.de> Date: Tue Jun 10 14:38:31 2014 +0200 Replaced lambda calls with '->' commit 9d8a1c2423fd686e51f1a9b5e400444619e40685 Author: Marek Takac <m.takac@finn.de> Date: Fri Jun 6 19:19:40 2014 +0200 Clean up commit 08f80e8c91e6f10100ab7ced4af75edc9971b045 Author: Marek Takac <m.takac@finn.de> Date: Fri Jun 6 19:03:38 2014 +0200 Delete ::ConnectionManagement-call(env)> commit 190c2e2d867020373c1ae4d9ad6715bf81e99da4 Author: Marek Takac <m.takac@finn.de> Date: Fri Jun 6 17:40:34 2014 +0200 Reset Gemfile.lock commit 0a32dcaef08f603fdbfd57b65abfde7fc702ebb9 Author: Marek Takac <m.takac@finn.de> Date: Fri Jun 6 14:43:58 2014 +0200 Small refactoring of the API specs commit 963bb3e84851598e870fb52c7e01097fa554ea8c Author: Marek Takac <m.takac@finn.de> Date: Wed Jun 4 17:10:15 2014 +0200 Basic implementation of APIv3 work package #get commit ffdb5641a7ecc6cbb4d5af7e0f6d04ba3493aee8 Author: Marek Takac <m.takac@finn.de> Date: Wed Jun 4 17:08:48 2014 +0200 Basic implementation of APIv3 work package #get commit 8d64840f02b768338a1aa2721cc93a5d782f2295 Author: Marek Takac <m.takac@finn.de> Date: Tue Jun 3 16:33:02 2014 +0200 Clening up commit 2caf393c94f9a82739daaca79625db17e9096934 Author: Marek Takac <m.takac@finn.de> Date: Tue Jun 3 16:30:50 2014 +0200 Work package #patch - incomplete tests commit d6b9a4f263fa2843e3f44b6fb9caae2bbb36d093 Author: Marek Takac <m.takac@finn.de> Date: Wed May 28 17:42:26 2014 +0200 Renamed #done_ratio to #percentage_done commit 583ba0b52564da99d241ed07e112efb0ed22acf9 Author: Marek Takac <m.takac@finn.de> Date: Wed May 28 17:30:42 2014 +0200 Cleanup commit 34bfb883771ce41c8de5e641514835b07164a011 Author: Marek Takac <m.takac@finn.de> Date: Wed May 28 17:14:09 2014 +0200 Added basic test & improved patch work package commit 377070acfec5f8efe911dc9c1e898584f4ccfa63 Author: Marek Takac <m.takac@finn.de> Date: Fri May 23 15:38:58 2014 +0200 Implemented basic batch update for work packages commit 9df0ffb916aad624ffe71cc23c3f53136ef29e22 Author: Marek Takac <m.takac@finn.de> Date: Fri May 23 14:41:56 2014 +0200 Set default limit and offset for GET work packages resource commit f1ac16b23f2f6632daf6a5759403dcf5335c014f Author: Marek Takac <m.takac@finn.de> Date: Fri May 23 14:18:00 2014 +0200 Created GET endpoint work work packages resource & N+1 query optimization commit 9a7bb32f4600fe04edb72c81af0b7ba9dd412b7b Author: Marek Takac <m.takac@finn.de> Date: Thu May 22 19:29:04 2014 +0200 Basic authorization for work package GET and PATCH commit da4b778d51798df6eb2e80fbf85029a4b3c06b23 Author: Marek Takac <m.takac@finn.de> Date: Thu May 22 15:51:10 2014 +0200 Completed basic implementation of get, patch, head and options requests for work package resource commit c8e8ab68af07412a999c16331af8f695cbd090af Author: Marek Takac <m.takac@finn.de> Date: Thu May 22 10:47:43 2014 +0200 Added target version attributes to the work package resource commit 2ab0bea6ac174258c301d9ede38d1ec0128459aa Author: Marek Takac <m.takac@finn.de> Date: Wed May 21 18:08:13 2014 +0200 Implemented work package update with some child resources commit 17edd10bb5c46d258d201ed426c6a7f86ea514e9 Author: Marek Takac <m.takac@finn.de> Date: Wed May 21 16:31:18 2014 +0200 Minor refactoring of work packages api commit a63f17622c1258d3b90be39792cd84448c15dafa Author: Marek Takac <m.takac@finn.de> Date: Wed May 21 16:28:48 2014 +0200 Created GET work package endpoint commit abcf2e50b48b64a23cb80fb087af50fa59c23cb7 Author: Marek Takac <m.takac@finn.de> Date: Tue May 20 14:40:47 2014 +0200 Created OP API entry point commit 4564bae6f5613b7032b09086db197f12f79a4e46 Author: Marek Takac <m.takac@finn.de> Date: Tue May 20 13:39:57 2014 +0200 Refactor authorize method (created service object) commit cb464d932917247c74df4b70e957c4011610331b Author: Marek Takac <m.takac@finn.de> Date: Tue May 20 11:15:31 2014 +0200 Created basic structure for Work packages API commit 00f3b7a2919dfd80feb0332e87b82141b4785904 Author: Marek Takac <m.takac@finn.de> Date: Tue May 13 16:29:30 2014 +0200 WorkPackage mapper changes commit 622ebd04eb3892dee12a8b32586276fd4431b9f1 Author: Marek Takac <m.takac@finn.de> Date: Tue May 13 01:30:02 2014 +0200 Added relationships to WorkPackage mapper commit 80ebe54d9083967ef0db582a5ea8c489ce9e6df6 Author: Marek Takac <m.takac@finn.de> Date: Tue May 13 01:14:57 2014 +0200 Created WorkPackage mapper class commit 2da9225aef96c56fa478d6f0a822afb4569aadda Author: Marek Takac <m.takac@finn.de> Date: Mon May 12 19:21:07 2014 +0200 Mappers for Grape API commit 5cd59c4ad66652a58703f6c6bcf4557baf687b3b Author: Marek Takac <m.takac@finn.de> Date: Tue Apr 29 16:54:24 2014 +0200 Created some decorators commit a5cb66e5b63813bd6bb3d776cb970c9649b995ba Author: Marek Takac <m.takac@finn.de> Date: Tue Apr 29 15:31:25 2014 +0200 Added pundit for authorization commit f909e896879cb2c2c51df7393bfc0b2bfb6806fd Author: Marek Takac <m.takac@finn.de> Date: Tue Apr 29 14:49:20 2014 +0200 Created work package representer & current_user helper method for API commit 5aad3c087a29ef5a70d5d58f22d374b90eb604d9 Author: Marek Takac <m.takac@finn.de> Date: Mon Apr 28 14:24:47 2014 +0200 Created basic structure for Work packages API commit b25a348619b5785b7004e8320f9b43cb249f5ca4 Author: Marek Takac <m.takac@finn.de> Date: Mon Apr 28 14:04:37 2014 +0200 Set up Grape API v3 commit be76a6500ed03ff4d2c14923179e70f825c0f413 Author: Marek Takac <m.takac@finn.de> Date: Mon Apr 28 13:58:38 2014 +0200 Added grape commit e204fa9de8f10200ed60205dd5529ec78cbd4bc9 Author: Marek Takac <m.takac@finn.de> Date: Tue Jun 10 15:03:47 2014 +0200 Removed print call commit 39b921adc7978b0ce4735eea54e3669f47a5f7fe Author: Marek Takac <m.takac@finn.de> Date: Tue Jun 10 14:39:35 2014 +0200 Removed 'spec/factories/priority_factory.rb commit 94c64ab855b8f12dd50365445709c573f6ab5f28 Author: Marek Takac <m.takac@finn.de> Date: Tue Jun 10 14:38:31 2014 +0200 Replaced lambda calls with '->' commit c2101b035219d1336d425bcb5c9e423bc4a928b6 Author: Marek Takac <m.takac@finn.de> Date: Fri Jun 6 19:19:40 2014 +0200 Clean up commit a03bc0d84ce772192076731750c77da03b8400ba Author: Marek Takac <m.takac@finn.de> Date: Fri Jun 6 19:03:38 2014 +0200 Delete ::ConnectionManagement-call(env)> commit 8b2fe0b01ecd4d447d60c4c22ba91126578c25c7 Author: Marek Takac <m.takac@finn.de> Date: Fri Jun 6 17:40:34 2014 +0200 Reset Gemfile.lock commit 5d6618eea42ba9b09985bb55fa9b0691ecf33065 Merge: f325a36 dab75c3 Author: Marek Takac <m.takac@finn.de> Date: Fri Jun 6 16:10:51 2014 +0200 Merge branch 'dev' into feature/api_v3_base commit f325a36d6fce4e43f4d0911710eaf1753bdd8b00 Author: Marek Takac <m.takac@finn.de> Date: Fri Jun 6 14:43:58 2014 +0200 Small refactoring of the API specs commit 84f78d669d3f748fe37be16a26fe9837e7666c5f Author: Marek Takac <m.takac@finn.de> Date: Wed Jun 4 17:10:15 2014 +0200 Basic implementation of APIv3 work package #get commit 82786a97173b40169f09fe79bd30715b5acee064 Author: Marek Takac <m.takac@finn.de> Date: Wed Jun 4 17:08:48 2014 +0200 Basic implementation of APIv3 work package #get commit b7dd82f85f1b7556a02a313a53fa06c18e8e7c25 Merge: f4ba4e8 5525bc3 Author: Marek Takac <m.takac@finn.de> Date: Tue Jun 3 17:15:48 2014 +0200 Merge commit 5525bc3d52001d550b85e95668f5b272ffb97378 Author: Marek Takac <m.takac@finn.de> Date: Tue Jun 3 16:33:02 2014 +0200 Clening up commit 9d27e3d412b093778f075870a577c523fe709589 Author: Marek Takac <m.takac@finn.de> Date: Tue Jun 3 16:30:50 2014 +0200 Work package #patch - incomplete tests commit 58ceeee83e59b30f7c755d2b7738f3d14e06bee8 Author: Marek Takac <m.takac@finn.de> Date: Wed May 28 17:42:26 2014 +0200 Renamed #done_ratio to #percentage_done commit 7165e32bc45f56571b570ffa03b9c1c34f06296c Author: Marek Takac <m.takac@finn.de> Date: Wed May 28 17:30:42 2014 +0200 Cleanup commit 235ecdeabede44d8901c6fbc13bbdebb184c3cc8 Author: Marek Takac <m.takac@finn.de> Date: Wed May 28 17:14:09 2014 +0200 Added basic test & improved patch work package commit 625f273dc1e90cb5b2e206790f9700b0ac9248a0 Author: Marek Takac <m.takac@finn.de> Date: Fri May 23 15:38:58 2014 +0200 Implemented basic batch update for work packages commit 20239886d43386a975a449366e09ad8aed83d158 Author: Marek Takac <m.takac@finn.de> Date: Fri May 23 14:41:56 2014 +0200 Set default limit and offset for GET work packages resource commit ad79163fd3d97af62b9aa605cd8a5d211501f2c1 Author: Marek Takac <m.takac@finn.de> Date: Fri May 23 14:18:00 2014 +0200 Created GET endpoint work work packages resource & N+1 query optimization commit c3dcba77f02ed4688faf8baf68d8f1811351ec03 Author: Marek Takac <m.takac@finn.de> Date: Thu May 22 19:29:04 2014 +0200 Basic authorization for work package GET and PATCH commit 73d8a8551da59c634cb3fffb2c7a581302263554 Author: Marek Takac <m.takac@finn.de> Date: Thu May 22 15:51:10 2014 +0200 Completed basic implementation of get, patch, head and options requests for work package resource commit 479fc4b00579bd4c7ff3c64712322f0087f081ed Author: Marek Takac <m.takac@finn.de> Date: Thu May 22 10:47:43 2014 +0200 Added target version attributes to the work package resource commit a72cff36a9e90efb01e5ccf7c394edc4a873cf46 Author: Marek Takac <m.takac@finn.de> Date: Wed May 21 18:08:13 2014 +0200 Implemented work package update with some child resources commit 6689628a7419039a34f07d0edff0eb855eb8fb98 Author: Marek Takac <m.takac@finn.de> Date: Wed May 21 16:31:18 2014 +0200 Minor refactoring of work packages api commit 97d4e9a1e6fcbdcda4ecb70d3f06d89936507019 Author: Marek Takac <m.takac@finn.de> Date: Wed May 21 16:28:48 2014 +0200 Created GET work package endpoint commit 1490621af1cee15de310e052f57fc5a542e2ad1a Author: Marek Takac <m.takac@finn.de> Date: Tue May 20 14:40:47 2014 +0200 Created OP API entry point commit 1e080b7936ae2d14ef324b70f95fafb15e9faa2c Author: Marek Takac <m.takac@finn.de> Date: Tue May 20 13:39:57 2014 +0200 Refactor authorize method (created service object) commit 1b0b894456e1e1a22c7b0d759e277125be50e76b Author: Marek Takac <m.takac@finn.de> Date: Tue May 20 11:15:31 2014 +0200 Created basic structure for Work packages API commit 6c8f83ae548fb1cca6049cfc2943301ac2e7cdb9 Author: Marek Takac <m.takac@finn.de> Date: Tue May 13 16:29:30 2014 +0200 WorkPackage mapper changes commit d2a7f29201f5d9922e7ec5a1e9c75852c55f84f6 Author: Marek Takac <m.takac@finn.de> Date: Tue May 13 01:30:02 2014 +0200 Added relationships to WorkPackage mapper commit 0122cd4392e587feef662e611cbf02f4bdb06a4d Author: Marek Takac <m.takac@finn.de> Date: Tue May 13 01:14:57 2014 +0200 Created WorkPackage mapper class commit 6a40cdd6bfca7dbc17c02c8a59531d1c6f33e919 Author: Marek Takac <m.takac@finn.de> Date: Mon May 12 19:21:07 2014 +0200 Mappers for Grape API commit 0a4f39be58b3851c1dbfb39618e63e16ea4b05ec Author: Marek Takac <m.takac@finn.de> Date: Tue Apr 29 16:54:24 2014 +0200 Created some decorators commit 21e1c42b54eee5704cf19a5a0e8abffa39a8d9a7 Author: Marek Takac <m.takac@finn.de> Date: Tue Apr 29 15:31:25 2014 +0200 Added pundit for authorization commit a76f23ec51d6b04e01ab521a9252c41cb377d6ff Author: Marek Takac <m.takac@finn.de> Date: Tue Apr 29 14:49:20 2014 +0200 Created work package representer & current_user helper method for API commit 4d92b359941367043e66e23373ead15ac92ba5d1 Author: Marek Takac <m.takac@finn.de> Date: Mon Apr 28 14:24:47 2014 +0200 Created basic structure for Work packages API commit d19a5d698a7d92c642011aac731a850106095057 Author: Marek Takac <m.takac@finn.de> Date: Mon Apr 28 14:04:37 2014 +0200 Set up Grape API v3 commit b270fa61643a3eba2d4a2d3828e90f5748dd9757 Author: Marek Takac <m.takac@finn.de> Date: Mon Apr 28 13:58:38 2014 +0200 Added grape Signed-off-by: Alex Coles <alex@alexbcoles.com>
11 years ago
:work_packages_api => [:get],
:'work_packages/reports' => [:report, :report_details],
:planning_elements => [:index, :all, :show, :recycle_bin],
:planning_element_journals => [:index]}
map.permission :export_work_packages, {:'work_packages' => [:index, :all]}
map.permission :add_work_packages, { :issues => [:new, :create, :update_form],
:'issues/previews' => :create,
:work_packages => [:new, :new_type, :preview, :create] }
map.permission :move_work_packages, {:'work_packages/moves' => [:new, :create]}, :require => :loggedin
map.permission :edit_work_packages, { :issues => [:edit, :update, :update_form],
:'work_packages/bulk' => [:edit, :update],
:work_packages => [:edit, :update, :new_type, :preview, :quoted],
:journals => :preview,
:planning_elements => [:new, :create, :edit, :update],
:planning_element_journals => [ [:create], {:require => :member} ] }
map.permission :add_work_package_notes, {:work_packages => [:edit, :update], :journals => [:new]}
map.permission :edit_work_package_notes, {:journals => [:edit, :update]}, :require => :loggedin
map.permission :edit_own_work_package_notes, {:journals => [:edit, :update]}, :require => :loggedin
map.permission :delete_work_packages, {:issues => :destroy,
:work_packages => :destroy,
:'work_packages/bulk' => :destroy,
:planning_elements => [:confirm_destroy,
:destroy,
:destroy_all,
:confirm_destroy_all]},
:require => :member
map.permission :manage_work_package_relations, {:work_package_relations => [:create, :destroy]}
map.permission :manage_subtasks, {}
# Queries
map.permission :manage_public_queries, {:queries => [:new, :edit, :star, :unstar, :destroy]}, :require => :member
map.permission :save_queries, {:queries => [:new, :edit, :star, :unstar, :destroy]}, :require => :loggedin
# Watchers
map.permission :view_work_package_watchers, {}
map.permission :add_work_package_watchers, {:watchers => [:new, :create]}
map.permission :delete_work_package_watchers, {:watchers => :destroy}
end
map.project_module :time_tracking do |map|
map.permission :log_time, {:timelog => [:new, :create, :edit, :update]}, :require => :loggedin
map.permission :view_time_entries, :timelog => [:index, :show], :time_entry_reports => [:report]
map.permission :edit_time_entries, {:timelog => [:new, :create, :edit, :update, :destroy]}, :require => :member
map.permission :edit_own_time_entries, {:timelog => [:new, :create, :edit, :update, :destroy]}, :require => :loggedin
map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member
end
map.project_module :news do |map|
map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy, :preview], :'news/comments' => [:destroy]}, :require => :member
map.permission :view_news, {:news => [:index, :show]}, :public => true
map.permission :comment_news, {:'news/comments' => :create}
end
map.project_module :wiki do |map|
map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member
map.permission :manage_wiki_menu, {:wiki_menu_items => [:edit, :update, :select_main_menu_item, :replace_main_menu_item]}, :require => :member
map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member
map.permission :change_wiki_parent_page, {:wiki => [:edit_parent_page, :update_parent_page]},
:require => :member
map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member
map.permission :view_wiki_pages, :wiki => [:index, :show, :special, :date_index]
map.permission :export_wiki_pages, :wiki => [:export]
map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate]
map.permission :edit_wiki_pages, :wiki => [:edit, :update, :preview, :add_attachment, :new, :new_child, :create]
map.permission :delete_wiki_pages_attachments, {}
map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member
map.permission :list_attachments, {:wiki => :list_attachments}, :require => :member
end
map.project_module :repository do |map|
map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member
map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph]
map.permission :view_changesets, :repositories => [:show, :revisions, :revision]
map.permission :commit_access, {}
map.permission :view_commit_author_statistics, {}
end
map.project_module :boards do |map|
map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :move, :destroy]}, :require => :member
map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true
map.permission :add_messages, {:messages => [:new, :create, :reply, :quote, :preview]}
map.permission :edit_messages, {:messages => [:edit, :update, :preview]}, :require => :member
map.permission :edit_own_messages, {:messages => [:edit, :update, :preview]}, :require => :loggedin
map.permission :delete_messages, {:messages => :destroy}, :require => :member
map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin
end
map.project_module :calendar do |map|
map.permission :view_calendar, :'work_packages/calendars' => [:index]
end
map.project_module :activity
map.project_module :timelines do |map|
map.permission :view_project_associations,
{:project_associations => [:index, :show]}
map.permission :edit_project_associations,
{:project_associations => [:edit, :update, :new,
:create, :available_projects]},
{:require => :member}
map.permission :delete_project_associations,
{:project_associations => [:confirm_destroy, :destroy]},
{:require => :member}
map.permission :view_timelines,
{:timelines => [:index, :show]}
map.permission :edit_timelines,
{:timelines => [:edit, :update, :new, :create]},
{:require => :member}
map.permission :delete_timelines,
{:timelines => [:confirm_destroy, :destroy]},
{:require => :member}
map.permission :view_reportings,
{:reportings => [:index, :all, :show]}
map.permission :edit_reportings,
{:reportings => [:new, :create, :edit, :update, :available_projects]},
{:require => :member}
map.permission :delete_reportings,
{:reportings => [:confirm_destroy, :destroy]},
{:require => :member}
end
end
Redmine::MenuManager.map :top_menu do |menu|
menu.push :my_page, { :controller => '/my', :action => 'page' }, :html => {:class => 'icon5 icon-star2'}, :if => Proc.new { User.current.logged? }
# projects menu will be added by Redmine::MenuManager::TopMenuHelper#render_projects_top_menu_node
menu.push :administration, { :controller => '/admin', :action => 'projects' }, :if => Proc.new { User.current.admin? }, :last => true
menu.push :help, OpenProject::Info.help_url, :last => true, :caption => I18n.t('label_help'), :html => { :accesskey => OpenProject::AccessKeys.key_for(:help), :class => "icon5 icon-help"}
end
Redmine::MenuManager.map :account_menu do |menu|
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? }
end
Redmine::MenuManager.map :application_menu do |menu|
# Empty
end
Redmine::MenuManager.map :my_menu do |menu|
menu.push :account, {:controller => '/my', :action => 'account'}, :caption => :label_my_account, :html => {:class => "icon2 icon-user1"}
menu.push :password, {:controller => '/my', :action => 'password'}, :caption => :button_change_password, :if => Proc.new { User.current.change_password_allowed? }, :html => {:class => "icon2 icon-locked"}
menu.push :delete_account, :deletion_info_path,
:caption => I18n.t('account.delete'),
:param => :user_id,
:if => Proc.new { Setting.users_deletable_by_self? },
:html => {:class => 'icon2 icon-delete'}
end
Redmine::MenuManager.map :admin_menu do |menu|
menu.push :projects, {:controller => '/admin', :action => 'projects'}, :caption => :label_project_plural, :html => {:class => "icon2 icon-list-view2"}
menu.push :users, {:controller => '/users'}, :caption => :label_user_plural, :html => {:class => "icon2 icon-user1"}
menu.push :groups, {:controller => '/groups'}, :caption => :label_group_plural, :html => {:class => "icon2 icon-group"}
menu.push :roles, {:controller => '/roles'}, :caption => :label_role_and_permissions, :html => {:class => "icon2 icon-settings"}
menu.push :types, {:controller => '/types'}, :caption => :label_type_plural, :html => {:class => "icon2 icon-tracker"}
menu.push :statuses, {:controller => '/statuses'}, :caption => :label_work_package_status_plural,
:html => {:class => 'statuses icon2 icon-status'}
menu.push :workflows, {:controller => '/workflows', :action => 'edit'}, :caption => Proc.new { Workflow.model_name.human }, :html => {:class => "icon2 icon-status"}
menu.push :custom_fields, {:controller => '/custom_fields'}, :caption => :label_custom_field_plural,
:html => {:class => 'custom_fields icon2 icon-status' }
menu.push :enumerations, {:controller => '/enumerations'}, :html => {:class => "icon2 icon-status"}
menu.push :settings, {:controller => '/settings'}, :html => {:class => "icon2 icon-settings2"}
menu.push :ldap_authentication, {:controller => '/ldap_auth_sources', :action => 'index'},
:html => {:class => 'server_authentication icon2 icon-status'}
menu.push :plugins, {:controller => '/admin', :action => 'plugins'}, :last => true, :html => {:class => "icon2 icon-status"}
menu.push :info, {:controller => '/admin', :action => 'info'}, :caption => :label_information_plural, :last => true, :html => {:class => "icon2 icon-info"}
menu.push :colors,
{:controller => '/planning_element_type_colors', :action => 'index'},
{:caption => :'timelines.admin_menu.colors', :html => {:class => "icon2 icon-status"}}
menu.push :project_types,
{:controller => '/project_types', :action => 'index'},
{:caption => :'timelines.admin_menu.project_types', :html => {:class => "icon2 icon-tracker"}}
end
Redmine::MenuManager.map :project_menu do |menu|
menu.push :overview, { :controller => '/projects', :action => 'show' },
:html => {:class => "icon2 icon-list-view2"}
menu.push :activity, { :controller => '/activities', :action => 'index' },
:param => :project_id,
:if => Proc.new { |p| p.module_enabled?("activity") },
:html => {:class => "icon2 icon-yes"}
menu.push :roadmap, { :controller => '/versions', :action => 'index' },
:param => :project_id,
:if => Proc.new { |p| p.shared_versions.any? },
:html => {:class => "icon2 icon-process-arrow1"}
menu.push :work_packages, { controller: '/work_packages', action: 'index' },
param: :project_id,
caption: :label_work_package_plural,
html: {
id: 'main-menu-work-packages',
class: "icon2 icon-copy",
"data-ui-route" => '',
query_menu_item: 'query_menu_item'
}
menu.push :new_work_package, { :controller => '/work_packages', :action => 'new'},
:param => :project_id,
:caption => :label_work_package_new,
:parent => :work_packages,
:html => { :accesskey => OpenProject::AccessKeys.key_for(:new_work_package), :class => "icon2 icon-add" }
menu.push :summary_field, {:controller => '/work_packages/reports', :action => 'report'},
:param => :project_id,
:caption => :label_workflow_summary,
:parent => :work_packages,
:html => { :class => "icon2 icon-stats4" }
menu.push :timelines, {:controller => '/timelines', :action => 'index'},
:param => :project_id,
:caption => :'timelines.project_menu.timelines',
:html => {:class => "icon2 icon-new-planning-element"}
menu.push :calendar, { :controller => '/work_packages/calendars', :action => 'index' },
:param => :project_id,
:caption => :label_calendar,
:html => {:class => "icon2 icon-calendar"}
menu.push :news, { :controller => '/news', :action => 'index' },
:param => :project_id,
:caption => :label_news_plural,
:html => {:class => "icon2 icon-news"}
menu.push :new_news, { :controller => '/news', :action => 'new' },
:param => :project_id,
:caption => :label_news_new,
:parent => :news,
:if => Proc.new { |p| User.current.allowed_to?(:manage_news, p.project) },
:html => {:class => "icon2 icon-add"}
menu.push :boards, { :controller => '/boards', :action => 'index', :id => nil },
:param => :project_id,
:if => Proc.new { |p| p.boards.any? },
:caption => :label_board_plural,
:html => {:class => "icon2 icon-ticket-note"}
menu.push :repository, { :controller => '/repositories', :action => 'show' },
:param => :project_id,
:if => Proc.new { |p| p.repository && !p.repository.new_record? },
:html => {:class => "icon2 icon-open-folder"}
menu.push :reportings, {:controller => '/reportings', :action => 'index'},
:param => :project_id,
:caption => :'timelines.project_menu.reportings',
:html => {:class => "icon2 icon-stats"}
menu.push :project_associations, {:controller => '/project_associations', :action => 'index'},
:param => :project_id,
:caption => :'timelines.project_menu.project_associations',
:if => Proc.new { |p| p.project_type.try :allows_association },
:html => {:class => "icon2 icon-dependency"}
menu.push :settings, { :controller => '/projects', :action => 'settings' },
:caption => :label_project_settings,
:last => true,
:html => {:class => "icon2 icon-settings2"}
end
Redmine::Activity.map do |activity|
activity.register :work_packages, class_name: 'Activity::WorkPackageActivityProvider'
activity.register :changesets, class_name: 'Activity::ChangesetActivityProvider'
activity.register :news, class_name: 'Activity::NewsActivityProvider', default: false
activity.register :wiki_edits, class_name: 'Activity::WikiContentActivityProvider', default: false
activity.register :messages, class_name: 'Activity::MessageActivityProvider', default: false
activity.register :time_entries, class_name: 'Activity::TimeEntryActivityProvider', default: false
end
Redmine::Search.map do |search|
search.register :work_packages
search.register :news
search.register :changesets
search.register :wiki_pages
search.register :messages
search.register :projects
end
Redmine::WikiFormatting.map do |format|
format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper
end