@@ -0,0 +1,44 | |||||
|
1 | # redMine - project management software | |||
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |||
|
3 | # | |||
|
4 | # This program is free software; you can redistribute it and/or | |||
|
5 | # modify it under the terms of the GNU General Public License | |||
|
6 | # as published by the Free Software Foundation; either version 2 | |||
|
7 | # of the License, or (at your option) any later version. | |||
|
8 | # | |||
|
9 | # This program is distributed in the hope that it will be useful, | |||
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
12 | # GNU General Public License for more details. | |||
|
13 | # | |||
|
14 | # You should have received a copy of the GNU General Public License | |||
|
15 | # along with this program; if not, write to the Free Software | |||
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
|
17 | ||||
|
18 | class WikisController < ApplicationController | |||
|
19 | layout 'base' | |||
|
20 | before_filter :find_project, :authorize | |||
|
21 | ||||
|
22 | # Create or update a project's wiki | |||
|
23 | def edit | |||
|
24 | @wiki = @project.wiki || Wiki.new(:project => @project) | |||
|
25 | @wiki.attributes = params[:wiki] | |||
|
26 | @wiki.save if @request.post? | |||
|
27 | render(:update) {|page| page.replace_html "tab-content-wiki", :partial => 'projects/settings/wiki'} | |||
|
28 | end | |||
|
29 | ||||
|
30 | # Delete a project's wiki | |||
|
31 | def destroy | |||
|
32 | if request.post? && params[:confirm] && @project.wiki | |||
|
33 | @project.wiki.destroy | |||
|
34 | redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'wiki' | |||
|
35 | end | |||
|
36 | end | |||
|
37 | ||||
|
38 | private | |||
|
39 | def find_project | |||
|
40 | @project = Project.find(params[:id]) | |||
|
41 | rescue ActiveRecord::RecordNotFound | |||
|
42 | render_404 | |||
|
43 | end | |||
|
44 | end |
@@ -0,0 +1,23 | |||||
|
1 | # redMine - project management software | |||
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |||
|
3 | # | |||
|
4 | # This program is free software; you can redistribute it and/or | |||
|
5 | # modify it under the terms of the GNU General Public License | |||
|
6 | # as published by the Free Software Foundation; either version 2 | |||
|
7 | # of the License, or (at your option) any later version. | |||
|
8 | # | |||
|
9 | # This program is distributed in the hope that it will be useful, | |||
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
12 | # GNU General Public License for more details. | |||
|
13 | # | |||
|
14 | # You should have received a copy of the GNU General Public License | |||
|
15 | # along with this program; if not, write to the Free Software | |||
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
|
17 | ||||
|
18 | class EnabledModule < ActiveRecord::Base | |||
|
19 | belongs_to :project | |||
|
20 | ||||
|
21 | validates_presence_of :name | |||
|
22 | validates_uniqueness_of :name, :scope => :project_id | |||
|
23 | end |
@@ -0,0 +1,4 | |||||
|
1 | <% labelled_tabular_form_for :project, @project, :url => { :action => "edit", :id => @project } do |f| %> | |||
|
2 | <%= render :partial => 'form', :locals => { :f => f } %> | |||
|
3 | <%= submit_tag l(:button_save) %> | |||
|
4 | <% end %> |
@@ -0,0 +1,22 | |||||
|
1 | <table class="list"> | |||
|
2 | <thead> | |||
|
3 | <th><%= l(:label_issue_category) %></th> | |||
|
4 | <th><%= l(:field_assigned_to) %></th> | |||
|
5 | <th style="width:15%"></th> | |||
|
6 | <th style="width:15%"></th> | |||
|
7 | </thead> | |||
|
8 | <tbody> | |||
|
9 | <% for category in @project.issue_categories %> | |||
|
10 | <% unless category.new_record? %> | |||
|
11 | <tr class="<%= cycle 'odd', 'even' %>"> | |||
|
12 | <td><%=h(category.name) %></td> | |||
|
13 | <td><%=h(category.assigned_to.name) if category.assigned_to %></td> | |||
|
14 | <td align="center"><small><%= link_to_if_authorized l(:button_edit), { :controller => 'issue_categories', :action => 'edit', :id => category }, :class => 'icon icon-edit' %></small></td> | |||
|
15 | <td align="center"><small><%= link_to_if_authorized l(:button_delete), {:controller => 'issue_categories', :action => 'destroy', :id => category}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></small></td> | |||
|
16 | </tr> | |||
|
17 | <% end %> | |||
|
18 | <% end %> | |||
|
19 | </tbody> | |||
|
20 | </table> | |||
|
21 | | |||
|
22 | <p><%= link_to_if_authorized l(:label_issue_category_new), :controller => 'projects', :action => 'add_issue_category', :id => @project %></p> |
@@ -0,0 +1,14 | |||||
|
1 | <% form_for :project, @project, | |||
|
2 | :url => { :action => 'modules', :id => @project }, | |||
|
3 | :html => {:id => 'modules-form'} do |f| %> | |||
|
4 | ||||
|
5 | <div class=box> | |||
|
6 | <% Redmine::AccessControl.available_project_modules.each do |m| %> | |||
|
7 | <p><label><%= check_box_tag 'enabled_modules[]', m, @project.module_enabled?(m) %> <%= m.to_s.humanize %></label></p> | |||
|
8 | <% end %> | |||
|
9 | </div> | |||
|
10 | ||||
|
11 | <p><%= check_all_links 'modules-form' %></p> | |||
|
12 | <p><%= submit_tag l(:button_save) %></p> | |||
|
13 | ||||
|
14 | <% end %> |
@@ -0,0 +1,20 | |||||
|
1 | <% remote_form_for :repository, @repository, | |||
|
2 | :url => { :controller => 'repositories', :action => 'edit', :id => @project }, | |||
|
3 | :builder => TabularFormBuilder do |f| %> | |||
|
4 | ||||
|
5 | <%= error_messages_for 'repository' %> | |||
|
6 | ||||
|
7 | <div class="box tabular"> | |||
|
8 | <p><label>SCM</label><%= scm_select_tag(@repository) %></p> | |||
|
9 | <%= repository_field_tags(f, @repository) if @repository %> | |||
|
10 | </div> | |||
|
11 | ||||
|
12 | <div class="contextual"> | |||
|
13 | <%= link_to(l(:button_delete), {:controller => 'repositories', :action => 'destroy', :id => @project}, | |||
|
14 | :confirm => l(:text_are_you_sure), | |||
|
15 | :method => :post, | |||
|
16 | :class => 'icon icon-del') if @repository && !@repository.new_record? %> | |||
|
17 | </div> | |||
|
18 | ||||
|
19 | <%= submit_tag((@repository.nil? || @repository.new_record?) ? l(:button_create) : l(:button_save)) %> | |||
|
20 | <% end %> |
@@ -0,0 +1,25 | |||||
|
1 | <table class="list"> | |||
|
2 | <thead> | |||
|
3 | <th><%= l(:label_version) %></th> | |||
|
4 | <th><%= l(:field_effective_date) %></th> | |||
|
5 | <th><%= l(:field_description) %></th> | |||
|
6 | <th><%= l(:label_wiki_page) unless @project.wiki.nil? %></th> | |||
|
7 | <th style="width:15%"></th> | |||
|
8 | <th style="width:15%"></th> | |||
|
9 | </thead> | |||
|
10 | <tbody> | |||
|
11 | <% for version in @project.versions.sort %> | |||
|
12 | <tr class="<%= cycle 'odd', 'even' %>"> | |||
|
13 | <td><%=h version.name %></td> | |||
|
14 | <td align="center"><%= format_date(version.effective_date) %></td> | |||
|
15 | <td><%=h version.description %></td> | |||
|
16 | <td><%= link_to(version.wiki_page_title, :controller => 'wiki', :page => Wiki.titleize(version.wiki_page_title)) unless version.wiki_page_title.blank? || @project.wiki.nil? %></td> | |||
|
17 | <td align="center"><small><%= link_to_if_authorized l(:button_edit), { :controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %></small></td> | |||
|
18 | <td align="center"><small><%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></small></td> | |||
|
19 | </td> | |||
|
20 | </tr> | |||
|
21 | <% end; reset_cycle %> | |||
|
22 | </tbody> | |||
|
23 | </table> | |||
|
24 | | |||
|
25 | <p><%= link_to_if_authorized l(:label_version_new), :controller => 'projects', :action => 'add_version', :id => @project %></p> |
@@ -0,0 +1,18 | |||||
|
1 | <% remote_form_for :wiki, @wiki, | |||
|
2 | :url => { :controller => 'wikis', :action => 'edit', :id => @project }, | |||
|
3 | :builder => TabularFormBuilder do |f| %> | |||
|
4 | ||||
|
5 | <%= error_messages_for 'wiki' %> | |||
|
6 | ||||
|
7 | <div class="box tabular"> | |||
|
8 | <p><%= f.text_field :start_page, :size => 60, :required => true %><br /> | |||
|
9 | <em><%= l(:text_unallowed_characters) %>: , . / ? ; : |</em></p> | |||
|
10 | </div> | |||
|
11 | ||||
|
12 | <div class="contextual"> | |||
|
13 | <%= link_to(l(:button_delete), {:controller => 'wikis', :action => 'destroy', :id => @project}, | |||
|
14 | :class => 'icon icon-del') if @wiki && !@wiki.new_record? %> | |||
|
15 | </div> | |||
|
16 | ||||
|
17 | <%= submit_tag((@wiki.nil? || @wiki.new_record?) ? l(:button_create) : l(:button_save)) %> | |||
|
18 | <% end %> |
@@ -0,0 +1,10 | |||||
|
1 | <h2><%=l(:label_confirmation)%></h2> | |||
|
2 | ||||
|
3 | <div class="box"><center> | |||
|
4 | <p><strong><%= @project.name %></strong><br /><%=l(:text_wiki_destroy_confirmation)%></p> | |||
|
5 | ||||
|
6 | <% form_tag({:controller => 'wikis', :action => 'destroy', :id => @project}) do %> | |||
|
7 | <%= hidden_field_tag "confirm", 1 %> | |||
|
8 | <%= submit_tag l(:button_delete) %> | |||
|
9 | <% end %> | |||
|
10 | </center></div> |
@@ -0,0 +1,18 | |||||
|
1 | class CreateEnabledModules < ActiveRecord::Migration | |||
|
2 | def self.up | |||
|
3 | create_table :enabled_modules do |t| | |||
|
4 | t.column :project_id, :integer | |||
|
5 | t.column :name, :string, :null => false | |||
|
6 | end | |||
|
7 | add_index :enabled_modules, [:project_id], :name => :enabled_modules_project_id | |||
|
8 | ||||
|
9 | # Enable all modules for existing projects | |||
|
10 | Project.find(:all).each do |project| | |||
|
11 | project.enabled_module_names = Redmine::AccessControl.available_project_modules | |||
|
12 | end | |||
|
13 | end | |||
|
14 | ||||
|
15 | def self.down | |||
|
16 | drop_table :enabled_modules | |||
|
17 | end | |||
|
18 | end |
@@ -0,0 +1,33 | |||||
|
1 | --- | |||
|
2 | enabled_modules_001: | |||
|
3 | name: issue_tracking | |||
|
4 | project_id: 1 | |||
|
5 | id: 1 | |||
|
6 | enabled_modules_002: | |||
|
7 | name: time_tracking | |||
|
8 | project_id: 1 | |||
|
9 | id: 2 | |||
|
10 | enabled_modules_003: | |||
|
11 | name: news | |||
|
12 | project_id: 1 | |||
|
13 | id: 3 | |||
|
14 | enabled_modules_004: | |||
|
15 | name: documents | |||
|
16 | project_id: 1 | |||
|
17 | id: 4 | |||
|
18 | enabled_modules_005: | |||
|
19 | name: files | |||
|
20 | project_id: 1 | |||
|
21 | id: 5 | |||
|
22 | enabled_modules_006: | |||
|
23 | name: wiki | |||
|
24 | project_id: 1 | |||
|
25 | id: 6 | |||
|
26 | enabled_modules_007: | |||
|
27 | name: repository | |||
|
28 | project_id: 1 | |||
|
29 | id: 7 | |||
|
30 | enabled_modules_008: | |||
|
31 | name: boards | |||
|
32 | project_id: 1 | |||
|
33 | id: 8 |
@@ -17,13 +17,23 | |||||
17 |
|
17 | |||
18 | class MembersController < ApplicationController |
|
18 | class MembersController < ApplicationController | |
19 | layout 'base' |
|
19 | layout 'base' | |
20 |
before_filter :find_ |
|
20 | before_filter :find_member, :except => :new | |
|
21 | before_filter :find_project, :only => :new | |||
|
22 | before_filter :authorize | |||
21 |
|
23 | |||
|
24 | def new | |||
|
25 | @project.members << Member.new(params[:member]) if request.post? | |||
|
26 | respond_to do |format| | |||
|
27 | format.html { redirect_to :action => 'settings', :tab => 'members', :id => @project } | |||
|
28 | format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/settings/members'} } | |||
|
29 | end | |||
|
30 | end | |||
|
31 | ||||
22 | def edit |
|
32 | def edit | |
23 | if request.post? and @member.update_attributes(params[:member]) |
|
33 | if request.post? and @member.update_attributes(params[:member]) | |
24 | respond_to do |format| |
|
34 | respond_to do |format| | |
25 | format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project } |
|
35 | format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project } | |
26 | format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/members'} } |
|
36 | format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/settings/members'} } | |
27 | end |
|
37 | end | |
28 | end |
|
38 | end | |
29 | end |
|
39 | end | |
@@ -32,12 +42,18 class MembersController < ApplicationController | |||||
32 | @member.destroy |
|
42 | @member.destroy | |
33 | respond_to do |format| |
|
43 | respond_to do |format| | |
34 | format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project } |
|
44 | format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project } | |
35 | format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/members'} } |
|
45 | format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/settings/members'} } | |
36 | end |
|
46 | end | |
37 | end |
|
47 | end | |
38 |
|
48 | |||
39 | private |
|
49 | private | |
40 | def find_project |
|
50 | def find_project | |
|
51 | @project = Project.find(params[:id]) | |||
|
52 | rescue ActiveRecord::RecordNotFound | |||
|
53 | render_404 | |||
|
54 | end | |||
|
55 | ||||
|
56 | def find_member | |||
41 | @member = Member.find(params[:id]) |
|
57 | @member = Member.find(params[:id]) | |
42 | @project = @member.project |
|
58 | @project = @member.project | |
43 | rescue ActiveRecord::RecordNotFound |
|
59 | rescue ActiveRecord::RecordNotFound |
@@ -73,16 +73,9 class ProjectsController < ApplicationController | |||||
73 | else |
|
73 | else | |
74 | @project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] |
|
74 | @project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids] | |
75 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => (params[:custom_fields] ? params["custom_fields"][x.id.to_s] : nil)) } |
|
75 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => (params[:custom_fields] ? params["custom_fields"][x.id.to_s] : nil)) } | |
76 |
@project.custom_values = @custom_values |
|
76 | @project.custom_values = @custom_values | |
77 | if params[:repository_enabled] && params[:repository_enabled] == "1" |
|
|||
78 | @project.repository = Repository.factory(params[:repository_scm]) |
|
|||
79 | @project.repository.attributes = params[:repository] |
|
|||
80 | end |
|
|||
81 | if "1" == params[:wiki_enabled] |
|
|||
82 | @project.wiki = Wiki.new |
|
|||
83 | @project.wiki.attributes = params[:wiki] |
|
|||
84 | end |
|
|||
85 | if @project.save |
|
77 | if @project.save | |
|
78 | @project.enabled_module_names = params[:enabled_modules] | |||
86 | flash[:notice] = l(:notice_successful_create) |
|
79 | flash[:notice] = l(:notice_successful_create) | |
87 | redirect_to :controller => 'admin', :action => 'projects' |
|
80 | redirect_to :controller => 'admin', :action => 'projects' | |
88 | end |
|
81 | end | |
@@ -107,6 +100,8 class ProjectsController < ApplicationController | |||||
107 | @issue_category ||= IssueCategory.new |
|
100 | @issue_category ||= IssueCategory.new | |
108 | @member ||= @project.members.new |
|
101 | @member ||= @project.members.new | |
109 | @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) } |
|
102 | @custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) } | |
|
103 | @repository ||= @project.repository | |||
|
104 | @wiki ||= @project.wiki | |||
110 | end |
|
105 | end | |
111 |
|
106 | |||
112 | # Edit @project |
|
107 | # Edit @project | |
@@ -117,24 +112,6 class ProjectsController < ApplicationController | |||||
117 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } |
|
112 | @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) } | |
118 | @project.custom_values = @custom_values |
|
113 | @project.custom_values = @custom_values | |
119 | end |
|
114 | end | |
120 | if params[:repository_enabled] |
|
|||
121 | case params[:repository_enabled] |
|
|||
122 | when "0" |
|
|||
123 | @project.repository = nil |
|
|||
124 | when "1" |
|
|||
125 | @project.repository ||= Repository.factory(params[:repository_scm]) |
|
|||
126 | @project.repository.update_attributes params[:repository] if @project.repository |
|
|||
127 | end |
|
|||
128 | end |
|
|||
129 | if params[:wiki_enabled] |
|
|||
130 | case params[:wiki_enabled] |
|
|||
131 | when "0" |
|
|||
132 | @project.wiki.destroy if @project.wiki |
|
|||
133 | when "1" |
|
|||
134 | @project.wiki ||= Wiki.new |
|
|||
135 | @project.wiki.update_attributes params[:wiki] |
|
|||
136 | end |
|
|||
137 | end |
|
|||
138 | @project.attributes = params[:project] |
|
115 | @project.attributes = params[:project] | |
139 | if @project.save |
|
116 | if @project.save | |
140 | flash[:notice] = l(:notice_successful_update) |
|
117 | flash[:notice] = l(:notice_successful_update) | |
@@ -145,6 +122,11 class ProjectsController < ApplicationController | |||||
145 | end |
|
122 | end | |
146 | end |
|
123 | end | |
147 | end |
|
124 | end | |
|
125 | ||||
|
126 | def modules | |||
|
127 | @project.enabled_module_names = params[:enabled_modules] | |||
|
128 | redirect_to :action => 'settings', :id => @project, :tab => 'modules' | |||
|
129 | end | |||
148 |
|
130 | |||
149 | def archive |
|
131 | def archive | |
150 | @project.archive if request.post? && @project.active? |
|
132 | @project.archive if request.post? && @project.active? | |
@@ -195,25 +177,6 class ProjectsController < ApplicationController | |||||
195 | end |
|
177 | end | |
196 | end |
|
178 | end | |
197 |
|
179 | |||
198 | # Add a new member to @project |
|
|||
199 | def add_member |
|
|||
200 | @member = @project.members.build(params[:member]) |
|
|||
201 | if request.post? && @member.save |
|
|||
202 | respond_to do |format| |
|
|||
203 | format.html { redirect_to :action => 'settings', :tab => 'members', :id => @project } |
|
|||
204 | format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'members'} } |
|
|||
205 | end |
|
|||
206 | else |
|
|||
207 | settings |
|
|||
208 | render :action => 'settings' |
|
|||
209 | end |
|
|||
210 | end |
|
|||
211 |
|
||||
212 | # Show members list of @project |
|
|||
213 | def list_members |
|
|||
214 | @members = @project.members.find(:all) |
|
|||
215 | end |
|
|||
216 |
|
||||
217 | # Add a new document to @project |
|
180 | # Add a new document to @project | |
218 | def add_document |
|
181 | def add_document | |
219 | @categories = Enumeration::get_values('DCAT') |
|
182 | @categories = Enumeration::get_values('DCAT') |
@@ -21,10 +21,29 require 'digest/sha1' | |||||
21 |
|
21 | |||
22 | class RepositoriesController < ApplicationController |
|
22 | class RepositoriesController < ApplicationController | |
23 | layout 'base' |
|
23 | layout 'base' | |
24 |
before_filter :find_ |
|
24 | before_filter :find_repository, :except => :edit | |
25 | before_filter :authorize, :except => [:update_form] |
|
25 | before_filter :find_project, :only => :edit | |
|
26 | before_filter :authorize | |||
26 | accept_key_auth :revisions |
|
27 | accept_key_auth :revisions | |
27 |
|
28 | |||
|
29 | def edit | |||
|
30 | @repository = @project.repository | |||
|
31 | if !@repository | |||
|
32 | @repository = Repository.factory(params[:repository_scm]) | |||
|
33 | @repository.project = @project | |||
|
34 | end | |||
|
35 | if request.post? | |||
|
36 | @repository.attributes = params[:repository] | |||
|
37 | @repository.save | |||
|
38 | end | |||
|
39 | render(:update) {|page| page.replace_html "tab-content-repository", :partial => 'projects/settings/repository'} | |||
|
40 | end | |||
|
41 | ||||
|
42 | def destroy | |||
|
43 | @repository.destroy | |||
|
44 | redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'repository' | |||
|
45 | end | |||
|
46 | ||||
28 | def show |
|
47 | def show | |
29 | # check if new revisions have been committed in the repository |
|
48 | # check if new revisions have been committed in the repository | |
30 | @repository.fetch_changesets if Setting.autofetch_changesets? |
|
49 | @repository.fetch_changesets if Setting.autofetch_changesets? | |
@@ -113,14 +132,15 class RepositoriesController < ApplicationController | |||||
113 | end |
|
132 | end | |
114 | end |
|
133 | end | |
115 |
|
134 | |||
116 | def update_form |
|
|||
117 | @repository = Repository.factory(params[:repository_scm]) |
|
|||
118 | render :partial => 'projects/repository', :locals => {:repository => @repository} |
|
|||
119 | end |
|
|||
120 |
|
||||
121 | private |
|
135 | private | |
122 | def find_project |
|
136 | def find_project | |
123 | @project = Project.find(params[:id]) |
|
137 | @project = Project.find(params[:id]) | |
|
138 | rescue ActiveRecord::RecordNotFound | |||
|
139 | render_404 | |||
|
140 | end | |||
|
141 | ||||
|
142 | def find_repository | |||
|
143 | @project = Project.find(params[:id]) | |||
124 | @repository = @project.repository |
|
144 | @repository = @project.repository | |
125 | render_404 and return false unless @repository |
|
145 | render_404 and return false unless @repository | |
126 | @path = params[:path].squeeze('/') if params[:path] |
|
146 | @path = params[:path].squeeze('/') if params[:path] |
@@ -26,6 +26,19 module ProjectsHelper | |||||
26 | }, options |
|
26 | }, options | |
27 | end |
|
27 | end | |
28 |
|
28 | |||
|
29 | def project_settings_tabs | |||
|
30 | tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural}, | |||
|
31 | {:name => 'modules', :action => :select_project_modules, :partial => 'projects/settings/modules', :label => :label_module_plural}, | |||
|
32 | {:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural}, | |||
|
33 | {:name => 'versions', :action => :manage_versions, :partial => 'projects/settings/versions', :label => :label_version_plural}, | |||
|
34 | {:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural}, | |||
|
35 | {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki}, | |||
|
36 | {:name => 'repository', :action => :manage_repository, :partial => 'projects/settings/repository', :label => :label_repository}, | |||
|
37 | {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural} | |||
|
38 | ] | |||
|
39 | tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)} | |||
|
40 | end | |||
|
41 | ||||
29 | # Generates a gantt image |
|
42 | # Generates a gantt image | |
30 | # Only defined if RMagick is avalaible |
|
43 | # Only defined if RMagick is avalaible | |
31 | def gantt_image(events, date_from, months, zoom) |
|
44 | def gantt_image(events, date_from, months, zoom) |
@@ -29,13 +29,13 module RepositoriesHelper | |||||
29 | send(method, form, repository) if repository.is_a?(Repository) && respond_to?(method) |
|
29 | send(method, form, repository) if repository.is_a?(Repository) && respond_to?(method) | |
30 | end |
|
30 | end | |
31 |
|
31 | |||
32 | def scm_select_tag |
|
32 | def scm_select_tag(repository) | |
33 | container = [[]] |
|
33 | container = [[]] | |
34 | REDMINE_SUPPORTED_SCM.each {|scm| container << ["Repository::#{scm}".constantize.scm_name, scm]} |
|
34 | REDMINE_SUPPORTED_SCM.each {|scm| container << ["Repository::#{scm}".constantize.scm_name, scm]} | |
35 | select_tag('repository_scm', |
|
35 | select_tag('repository_scm', | |
36 |
options_for_select(container, |
|
36 | options_for_select(container, repository.class.name.demodulize), | |
37 |
:disabled => ( |
|
37 | :disabled => (repository && !repository.new_record?), | |
38 |
:onchange => remote_function( |
|
38 | :onchange => remote_function(:url => { :controller => 'repositories', :action => 'edit', :id => @project }, :method => :get, :with => "Form.serialize(this.form)") | |
39 | ) |
|
39 | ) | |
40 | end |
|
40 | end | |
41 |
|
41 |
@@ -23,6 +23,7 class Project < ActiveRecord::Base | |||||
23 | has_many :members, :dependent => :delete_all, :include => :user, :conditions => "#{User.table_name}.status=#{User::STATUS_ACTIVE}" |
|
23 | has_many :members, :dependent => :delete_all, :include => :user, :conditions => "#{User.table_name}.status=#{User::STATUS_ACTIVE}" | |
24 | has_many :users, :through => :members |
|
24 | has_many :users, :through => :members | |
25 | has_many :custom_values, :dependent => :delete_all, :as => :customized |
|
25 | has_many :custom_values, :dependent => :delete_all, :as => :customized | |
|
26 | has_many :enabled_modules, :dependent => :delete_all | |||
26 | has_many :issues, :dependent => :destroy, :order => "#{Issue.table_name}.created_on DESC", :include => [:status, :tracker] |
|
27 | has_many :issues, :dependent => :destroy, :order => "#{Issue.table_name}.created_on DESC", :include => [:status, :tracker] | |
27 | has_many :issue_changes, :through => :issues, :source => :journals |
|
28 | has_many :issue_changes, :through => :issues, :source => :journals | |
28 | has_many :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC" |
|
29 | has_many :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC" | |
@@ -38,7 +39,7 class Project < ActiveRecord::Base | |||||
38 | has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", :association_foreign_key => 'custom_field_id' |
|
39 | has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", :association_foreign_key => 'custom_field_id' | |
39 | acts_as_tree :order => "name", :counter_cache => true |
|
40 | acts_as_tree :order => "name", :counter_cache => true | |
40 |
|
41 | |||
41 | attr_protected :status |
|
42 | attr_protected :status, :enabled_module_names | |
42 |
|
43 | |||
43 | validates_presence_of :name, :description, :identifier |
|
44 | validates_presence_of :name, :description, :identifier | |
44 | validates_uniqueness_of :name, :identifier |
|
45 | validates_uniqueness_of :name, :identifier | |
@@ -121,10 +122,43 class Project < ActiveRecord::Base | |||||
121 | def <=>(project) |
|
122 | def <=>(project) | |
122 | name <=> project.name |
|
123 | name <=> project.name | |
123 | end |
|
124 | end | |
|
125 | ||||
|
126 | def allows_to?(action) | |||
|
127 | if action.is_a? Hash | |||
|
128 | allowed_actions.include? "#{action[:controller]}/#{action[:action]}" | |||
|
129 | else | |||
|
130 | allowed_permissions.include? action | |||
|
131 | end | |||
|
132 | end | |||
|
133 | ||||
|
134 | def module_enabled?(module_name) | |||
|
135 | module_name = module_name.to_s | |||
|
136 | enabled_modules.detect {|m| m.name == module_name} | |||
|
137 | end | |||
|
138 | ||||
|
139 | def enabled_module_names=(module_names) | |||
|
140 | enabled_modules.clear | |||
|
141 | module_names = [] unless module_names && module_names.is_a?(Array) | |||
|
142 | module_names.each do |name| | |||
|
143 | enabled_modules << EnabledModule.new(:name => name.to_s) | |||
|
144 | end | |||
|
145 | end | |||
124 |
|
146 | |||
125 | protected |
|
147 | protected | |
126 | def validate |
|
148 | def validate | |
127 | errors.add(parent_id, " must be a root project") if parent and parent.parent |
|
149 | errors.add(parent_id, " must be a root project") if parent and parent.parent | |
128 | errors.add_to_base("A project with subprojects can't be a subproject") if parent and children.size > 0 |
|
150 | errors.add_to_base("A project with subprojects can't be a subproject") if parent and children.size > 0 | |
129 | end |
|
151 | end | |
|
152 | ||||
|
153 | private | |||
|
154 | def allowed_permissions | |||
|
155 | @allowed_permissions ||= begin | |||
|
156 | module_names = enabled_modules.collect {|m| m.name} | |||
|
157 | Redmine::AccessControl.modules_permissions(module_names).collect {|p| p.name} | |||
|
158 | end | |||
|
159 | end | |||
|
160 | ||||
|
161 | def allowed_actions | |||
|
162 | @actions_allowed ||= allowed_permissions.inject([]) { |actions, permission| actions += Redmine::AccessControl.allowed_actions(permission) }.flatten | |||
|
163 | end | |||
130 | end |
|
164 | end |
@@ -178,8 +178,13 class User < ActiveRecord::Base | |||||
178 | # * a parameter-like Hash (eg. :controller => 'projects', :action => 'edit') |
|
178 | # * a parameter-like Hash (eg. :controller => 'projects', :action => 'edit') | |
179 | # * a permission Symbol (eg. :edit_project) |
|
179 | # * a permission Symbol (eg. :edit_project) | |
180 | def allowed_to?(action, project) |
|
180 | def allowed_to?(action, project) | |
|
181 | # No action allowed on archived projects | |||
181 | return false unless project.active? |
|
182 | return false unless project.active? | |
|
183 | # No action allowed on disabled modules | |||
|
184 | return false unless project.allows_to?(action) | |||
|
185 | # Admin users are authorized for anything else | |||
182 | return true if admin? |
|
186 | return true if admin? | |
|
187 | ||||
183 | role = role_for_project(project) |
|
188 | role = role_for_project(project) | |
184 | return false unless role |
|
189 | return false unless role | |
185 | role.allowed_to?(action) && (project.is_public? || role.member?) |
|
190 | role.allowed_to?(action) && (project.is_public? || role.member?) |
@@ -2,5 +2,5 | |||||
2 |
|
2 | |||
3 | <% labelled_tabular_form_for :category, @category, :url => { :action => 'edit', :id => @category } do |f| %> |
|
3 | <% labelled_tabular_form_for :category, @category, :url => { :action => 'edit', :id => @category } do |f| %> | |
4 | <%= render :partial => 'issue_categories/form', :locals => { :f => f } %> |
|
4 | <%= render :partial => 'issue_categories/form', :locals => { :f => f } %> | |
5 |
<%= submit_tag l(:button_ |
|
5 | <%= submit_tag l(:button_save) %> | |
6 | <% end %> |
|
6 | <% end %> |
@@ -71,7 +71,7 | |||||
71 | <% if @project && !@project.new_record? %> |
|
71 | <% if @project && !@project.new_record? %> | |
72 | <h2><%= @project.name %></h2> |
|
72 | <h2><%= @project.name %></h2> | |
73 | <ul class="menublock"> |
|
73 | <ul class="menublock"> | |
74 |
<% Redmine::MenuManager.allowed_items(:project_menu, current |
|
74 | <% Redmine::MenuManager.allowed_items(:project_menu, User.current, @project).each do |item| %> | |
75 | <% unless item.condition && !item.condition.call(@project) %> |
|
75 | <% unless item.condition && !item.condition.call(@project) %> | |
76 | <li><%= link_to l(item.name), {item.param => @project}.merge(item.url) %></li> |
|
76 | <li><%= link_to l(item.name), {item.param => @project}.merge(item.url) %></li> | |
77 | <% end %> |
|
77 | <% end %> |
@@ -28,32 +28,6 | |||||
28 | <!--[eoform:project]--> |
|
28 | <!--[eoform:project]--> | |
29 | </div> |
|
29 | </div> | |
30 |
|
30 | |||
31 | <div class="box"> |
|
|||
32 | <h3><%= check_box_tag "repository_enabled", 1, !@project.repository.nil?, :onclick => "Element.toggle('repository');" %> <%= l(:label_repository) %></h3> |
|
|||
33 | <%= hidden_field_tag "repository_enabled", 0 %> |
|
|||
34 | <div id="repository"> |
|
|||
35 | <p class="tabular"><label>SCM</label><%= scm_select_tag %></p> |
|
|||
36 | <div id="repository_fields"> |
|
|||
37 | <%= render :partial => 'projects/repository', :locals => {:repository => @project.repository} if @project.repository %> |
|
|||
38 | </div> |
|
|||
39 | </div> |
|
|||
40 | </div> |
|
|||
41 | <%= javascript_tag "Element.hide('repository');" if @project.repository.nil? %> |
|
|||
42 |
|
||||
43 | <div class="box"> |
|
|||
44 | <h3><%= check_box_tag "wiki_enabled", 1, !@project.wiki.nil?, :onclick => "Element.toggle('wiki');" %> <%= l(:label_wiki) %></h3> |
|
|||
45 | <%= hidden_field_tag "wiki_enabled", 0 %> |
|
|||
46 | <div id="wiki"> |
|
|||
47 | <% fields_for :wiki, @project.wiki, { :builder => TabularFormBuilder, :lang => current_language} do |wiki| %> |
|
|||
48 | <p><%= wiki.text_field :start_page, :size => 60, :required => true %><br /><em><%= l(:text_unallowed_characters) %>: , . / ? ; : |</em></p> |
|
|||
49 | <% # content_tag("div", "", :id => "wiki_start_page_auto_complete", :class => "auto_complete") + |
|
|||
50 | # auto_complete_field("wiki_start_page", { :url => { :controller => 'wiki', :action => 'auto_complete_for_wiki_page', :id => @project } }) |
|
|||
51 | %> |
|
|||
52 | <% end %> |
|
|||
53 | </div> |
|
|||
54 | <%= javascript_tag "Element.hide('wiki');" if @project.wiki.nil? %> |
|
|||
55 | </div> |
|
|||
56 |
|
||||
57 | <% content_for :header_tags do %> |
|
31 | <% content_for :header_tags do %> | |
58 | <%= javascript_include_tag 'calendar/calendar' %> |
|
32 | <%= javascript_include_tag 'calendar/calendar' %> | |
59 | <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %> |
|
33 | <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %> |
@@ -2,5 +2,14 | |||||
2 |
|
2 | |||
3 | <% labelled_tabular_form_for :project, @project, :url => { :action => "add" } do |f| %> |
|
3 | <% labelled_tabular_form_for :project, @project, :url => { :action => "add" } do |f| %> | |
4 | <%= render :partial => 'form', :locals => { :f => f } %> |
|
4 | <%= render :partial => 'form', :locals => { :f => f } %> | |
|
5 | ||||
|
6 | <div class="box"> | |||
|
7 | <p><label><%= l(:label_module_plural) %></label> | |||
|
8 | <% Redmine::AccessControl.available_project_modules.each do |m| %> | |||
|
9 | <%= check_box_tag 'enabled_modules[]', m, @project.module_enabled?(m) %> <%= m.to_s.humanize %> | |||
|
10 | <% end %></p> | |||
|
11 | </div> | |||
|
12 | ||||
|
13 | ||||
5 | <%= submit_tag l(:button_save) %> |
|
14 | <%= submit_tag l(:button_save) %> | |
6 | <% end %> No newline at end of file |
|
15 | <% end %> |
@@ -2,83 +2,15 | |||||
2 |
|
2 | |||
3 | <div class="tabs"> |
|
3 | <div class="tabs"> | |
4 | <ul> |
|
4 | <ul> | |
5 | <li><%= link_to l(:label_information_plural), {}, :id=> "tab-info", :onclick => "showTab('info'); this.blur(); return false;" %></li> |
|
5 | <% project_settings_tabs.each do |tab| %> | |
6 |
<li><%= link_to l(:label |
|
6 | <li><%= link_to l(tab[:label]), {}, :id => "tab-#{tab[:name]}", :onclick => "showTab('#{tab[:name]}'); this.blur(); return false;" %></li> | |
7 | <li><%= link_to l(:label_version_plural), {}, :id=> "tab-versions", :onclick => "showTab('versions'); this.blur(); return false;" %></li> |
|
|||
8 | <li><%= link_to l(:label_issue_category_plural), {}, :id=> "tab-categories", :onclick => "showTab('categories'); this.blur(); return false;" %></li> |
|
|||
9 | <li><%= link_to l(:label_board_plural), {}, :id=> "tab-boards", :onclick => "showTab('boards'); this.blur(); return false;" %></li> |
|
|||
10 | </ul> |
|
|||
11 | </div> |
|
|||
12 |
|
||||
13 | <div id="tab-content-info" class="tab-content"> |
|
|||
14 | <% if authorize_for('projects', 'edit') %> |
|
|||
15 | <% labelled_tabular_form_for :project, @project, :url => { :action => "edit", :id => @project } do |f| %> |
|
|||
16 | <%= render :partial => 'form', :locals => { :f => f } %> |
|
|||
17 | <%= submit_tag l(:button_save) %> |
|
|||
18 | <% end %> |
|
|||
19 | <% end %> |
|
7 | <% end %> | |
|
8 | </ul> | |||
20 | </div> |
|
9 | </div> | |
21 |
|
10 | |||
22 | <div id="tab-content-members" class="tab-content" style="display:none;"> |
|
11 | <% project_settings_tabs.each do |tab| %> | |
23 | <%= render :partial => 'members' %> |
|
12 | <%= content_tag('div', render(:partial => tab[:partial]), :id => "tab-content-#{tab[:name]}", :class => 'tab-content') %> | |
24 | </div> |
|
|||
25 |
|
||||
26 | <div id="tab-content-versions" class="tab-content" style="display:none;"> |
|
|||
27 | <table class="list"> |
|
|||
28 | <thead> |
|
|||
29 | <th><%= l(:label_version) %></th> |
|
|||
30 | <th><%= l(:field_effective_date) %></th> |
|
|||
31 | <th><%= l(:field_description) %></th> |
|
|||
32 | <th><%= l(:label_wiki_page) unless @project.wiki.nil? %></th> |
|
|||
33 | <th style="width:15%"></th> |
|
|||
34 | <th style="width:15%"></th> |
|
|||
35 | </thead> |
|
|||
36 | <tbody> |
|
|||
37 | <% for version in @project.versions.sort %> |
|
|||
38 | <tr class="<%= cycle 'odd', 'even' %>"> |
|
|||
39 | <td><%=h version.name %></td> |
|
|||
40 | <td align="center"><%= format_date(version.effective_date) %></td> |
|
|||
41 | <td><%=h version.description %></td> |
|
|||
42 | <td><%= link_to(version.wiki_page_title, :controller => 'wiki', :page => Wiki.titleize(version.wiki_page_title)) unless version.wiki_page_title.blank? || @project.wiki.nil? %></td> |
|
|||
43 | <td align="center"><small><%= link_to_if_authorized l(:button_edit), { :controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %></small></td> |
|
|||
44 | <td align="center"><small><%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></small></td> |
|
|||
45 | </td> |
|
|||
46 | </tr> |
|
|||
47 | <% end; reset_cycle %> |
|
|||
48 | </tbody> |
|
|||
49 | </table> |
|
|||
50 | |
|
|||
51 | <p><%= link_to_if_authorized l(:label_version_new), :controller => 'projects', :action => 'add_version', :id => @project %></p> |
|
|||
52 | </div> |
|
|||
53 |
|
||||
54 | <div id="tab-content-categories" class="tab-content" style="display:none;"> |
|
|||
55 | <table class="list"> |
|
|||
56 | <thead> |
|
|||
57 | <th><%= l(:label_issue_category) %></th> |
|
|||
58 | <th><%= l(:field_assigned_to) %></th> |
|
|||
59 | <th style="width:15%"></th> |
|
|||
60 | <th style="width:15%"></th> |
|
|||
61 | </thead> |
|
|||
62 | <tbody> |
|
|||
63 | <% for category in @project.issue_categories %> |
|
|||
64 | <% unless category.new_record? %> |
|
|||
65 | <tr class="<%= cycle 'odd', 'even' %>"> |
|
|||
66 | <td><%=h(category.name) %></td> |
|
|||
67 | <td><%=h(category.assigned_to.name) if category.assigned_to %></td> |
|
|||
68 | <td align="center"><small><%= link_to_if_authorized l(:button_edit), { :controller => 'issue_categories', :action => 'edit', :id => category }, :class => 'icon icon-edit' %></small></td> |
|
|||
69 | <td align="center"><small><%= link_to_if_authorized l(:button_delete), {:controller => 'issue_categories', :action => 'destroy', :id => category}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></small></td> |
|
|||
70 | </tr> |
|
|||
71 | <% end %> |
|
|||
72 | <% end %> |
|
13 | <% end %> | |
73 | </tbody> |
|
|||
74 | </table> |
|
|||
75 | |
|
|||
76 | <p><%= link_to_if_authorized l(:label_issue_category_new), :controller => 'projects', :action => 'add_issue_category', :id => @project %></p> |
|
|||
77 | </div> |
|
|||
78 |
|
||||
79 | <div id="tab-content-boards" class="tab-content" style="display:none;"> |
|
|||
80 | <%= render :partial => 'boards' %> |
|
|||
81 | </div> |
|
|||
82 |
|
14 | |||
83 |
<%= tab = params[:tab] ? h(params[:tab]) : |
|
15 | <%= tab = params[:tab] ? h(params[:tab]) : project_settings_tabs.first[:name] | |
84 | javascript_tag "showTab('#{tab}');" %> No newline at end of file |
|
16 | javascript_tag "showTab('#{tab}');" %> |
1 | NO CONTENT: file renamed from app/views/projects/_boards.rhtml to app/views/projects/settings/_boards.rhtml |
|
NO CONTENT: file renamed from app/views/projects/_boards.rhtml to app/views/projects/settings/_boards.rhtml |
@@ -33,8 +33,8 | |||||
33 | </table> |
|
33 | </table> | |
34 | |
|
34 | | |
35 |
|
35 | |||
36 |
<% if authorize_for(' |
|
36 | <% if authorize_for('members', 'new') && !users.empty? %> | |
37 |
<% remote_form_for(:member, @member, :url => {:controller => ' |
|
37 | <% remote_form_for(:member, @member, :url => {:controller => 'members', :action => 'new', :id => @project}, :method => :post) do |f| %> | |
38 | <p><label for="member_user_id"><%=l(:label_member_new)%></label><br /> |
|
38 | <p><label for="member_user_id"><%=l(:label_member_new)%></label><br /> | |
39 | <%= f.select :user_id, users.collect{|user| [user.name, user.id]} %> |
|
39 | <%= f.select :user_id, users.collect{|user| [user.name, user.id]} %> | |
40 | <%= l(:label_role) %>: <%= f.select :role_id, roles.collect{|role| [role.name, role.id]}, :selected => nil %> |
|
40 | <%= l(:label_role) %>: <%= f.select :role_id, roles.collect{|role| [role.name, role.id]}, :selected => nil %> |
@@ -19,6 +19,7 | |||||
19 | <% end %> |
|
19 | <% end %> | |
20 | </ul> |
|
20 | </ul> | |
21 |
|
21 | |||
|
22 | <% if User.current.allowed_to?(:view_issues, @project) %> | |||
22 | <div class="box"> |
|
23 | <div class="box"> | |
23 | <div class="contextual"><% if authorize_for('projects', 'add_issue') %><%= l(:label_issue_new) %>: <%= new_issue_selector %><% end %></div> |
|
24 | <div class="contextual"><% if authorize_for('projects', 'add_issue') %><%= l(:label_issue_new) %>: <%= new_issue_selector %><% end %></div> | |
24 | <h3 class="icon22 icon22-tracker"><%=l(:label_issue_tracking)%></h3> |
|
25 | <h3 class="icon22 icon22-tracker"><%=l(:label_issue_tracking)%></h3> | |
@@ -33,6 +34,7 | |||||
33 | </ul> |
|
34 | </ul> | |
34 | <p class="textcenter"><small><%= link_to l(:label_issue_view_all), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %></small></p> |
|
35 | <p class="textcenter"><small><%= link_to l(:label_issue_view_all), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %></small></p> | |
35 | </div> |
|
36 | </div> | |
|
37 | <% end %> | |||
36 | </div> |
|
38 | </div> | |
37 |
|
39 | |||
38 | <div class="splitcontentright"> |
|
40 | <div class="splitcontentright"> |
@@ -2,19 +2,23 | |||||
2 |
|
2 | |||
3 | <div class="box"> |
|
3 | <div class="box"> | |
4 | <p><%= f.text_field :name, :required => true, :disabled => @role.builtin? %></p> |
|
4 | <p><%= f.text_field :name, :required => true, :disabled => @role.builtin? %></p> | |
5 | </div> |
|
|||
6 | <p><%= f.check_box :assignable %></p> |
|
5 | <p><%= f.check_box :assignable %></p> | |
7 | <div class="clear"></div> |
|
6 | </div> | |
8 |
|
7 | |||
9 | <fieldset class="box"><legend><%=l(:label_permissions)%></legend> |
|
8 | <div class="box"> | |
10 | <% @permissions.each do |permission| %> |
|
9 | <h3><%= l(:label_permissions) %></h3> | |
11 | <div style="width:220px;float:left;"> |
|
10 | ||
12 | <%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %> |
|
11 | <% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %> | |
13 | <%= permission.name.to_s.humanize %> |
|
12 | <% perms_by_module.keys.sort.each do |mod| %> | |
14 | </div> |
|
13 | <fieldset><legend><%= mod.blank? ? l(:label_project) : mod.humanize %></legend> | |
|
14 | <% perms_by_module[mod].each do |permission| %> | |||
|
15 | <div style="width:220px;float:left;"> | |||
|
16 | <%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %> | |||
|
17 | <%= permission.name.to_s.humanize %> | |||
|
18 | </div> | |||
|
19 | <% end %> | |||
|
20 | </fieldset> | |||
15 | <% end %> |
|
21 | <% end %> | |
|
22 | <br /><%= check_all_links 'role_form' %> | |||
16 | <%= hidden_field_tag 'role[permissions][]', '' %> |
|
23 | <%= hidden_field_tag 'role[permissions][]', '' %> | |
17 | <div class="clear"></div> |
|
24 | </div> | |
18 | <br /> |
|
|||
19 | <%= check_all_links 'role_form' %> |
|
|||
20 | </fieldset> |
|
@@ -12,17 +12,23 | |||||
12 | </tr> |
|
12 | </tr> | |
13 | </thead> |
|
13 | </thead> | |
14 | <tbody> |
|
14 | <tbody> | |
15 | <% @permissions.each do |permission| %> |
|
15 | <% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %> | |
16 | <tr class="<%= cycle('odd', 'even') %>"> |
|
16 | <% perms_by_module.keys.sort.each do |mod| %> | |
17 | <td><%= permission.name.to_s.humanize %></td> |
|
17 | <% unless mod.blank? %> | |
18 | <% @roles.each do |role| %> |
|
18 | <tr><%= content_tag('th', mod.humanize, :colspan => (@roles.size + 1)) %></th></tr> | |
19 | <td align="center"> |
|
|||
20 | <% if role.setable_permissions.include? permission %> |
|
|||
21 | <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name) %> |
|
|||
22 | <% end %> |
|
19 | <% end %> | |
23 | </td> |
|
20 | <% perms_by_module[mod].each do |permission| %> | |
|
21 | <tr class="<%= cycle('odd', 'even') %>"> | |||
|
22 | <td><%= permission.name.to_s.humanize %></td> | |||
|
23 | <% @roles.each do |role| %> | |||
|
24 | <td align="center"> | |||
|
25 | <% if role.setable_permissions.include? permission %> | |||
|
26 | <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name) %> | |||
|
27 | <% end %> | |||
|
28 | </td> | |||
|
29 | <% end %> | |||
|
30 | </tr> | |||
24 | <% end %> |
|
31 | <% end %> | |
25 | </tr> |
|
|||
26 | <% end %> |
|
32 | <% end %> | |
27 | </tbody> |
|
33 | </tbody> | |
28 | </table> |
|
34 | </table> |
@@ -415,6 +415,7 label_language_based: Language based | |||||
415 | label_sort_by: Sort by "%s" |
|
415 | label_sort_by: Sort by "%s" | |
416 | label_send_test_email: Send a test email |
|
416 | label_send_test_email: Send a test email | |
417 | label_feeds_access_key_created_on: RSS access key created %s ago |
|
417 | label_feeds_access_key_created_on: RSS access key created %s ago | |
|
418 | label_module_plural: Modules | |||
418 |
|
419 | |||
419 | button_login: Вход |
|
420 | button_login: Вход | |
420 | button_submit: Изпращане |
|
421 | button_submit: Изпращане | |
@@ -474,6 +475,7 text_comma_separated: Позволено е изброяване (с разде | |||||
474 | text_issues_ref_in_commit_messages: Отбелязване и приключване на задачи от commit съобщения |
|
475 | text_issues_ref_in_commit_messages: Отбелязване и приключване на задачи от commit съобщения | |
475 | text_issue_added: Публикувана е нова задача с номер %s. |
|
476 | text_issue_added: Публикувана е нова задача с номер %s. | |
476 | text_issue_updated: Задача %s е обновена. |
|
477 | text_issue_updated: Задача %s е обновена. | |
|
478 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |||
477 |
|
479 | |||
478 | default_role_manager: Мениджър |
|
480 | default_role_manager: Мениджър | |
479 | default_role_developper: Разработчик |
|
481 | default_role_developper: Разработчик |
@@ -415,6 +415,7 label_language_based: Language based | |||||
415 | label_sort_by: Sort by "%s" |
|
415 | label_sort_by: Sort by "%s" | |
416 | label_send_test_email: Send a test email |
|
416 | label_send_test_email: Send a test email | |
417 | label_feeds_access_key_created_on: RSS access key created %s ago |
|
417 | label_feeds_access_key_created_on: RSS access key created %s ago | |
|
418 | label_module_plural: Modules | |||
418 |
|
419 | |||
419 | button_login: Einloggen |
|
420 | button_login: Einloggen | |
420 | button_submit: OK |
|
421 | button_submit: OK | |
@@ -474,6 +475,7 text_comma_separated: Multiple values allowed (comma separated). | |||||
474 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages |
|
475 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages | |
475 | text_issue_added: Ticket %s wurde erstellt. |
|
476 | text_issue_added: Ticket %s wurde erstellt. | |
476 | text_issue_updated: Ticket %s wurde aktualisiert. |
|
477 | text_issue_updated: Ticket %s wurde aktualisiert. | |
|
478 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |||
477 |
|
479 | |||
478 | default_role_manager: Manager |
|
480 | default_role_manager: Manager | |
479 | default_role_developper: Developer |
|
481 | default_role_developper: Developer |
@@ -415,6 +415,7 label_language_based: Language based | |||||
415 | label_sort_by: Sort by "%s" |
|
415 | label_sort_by: Sort by "%s" | |
416 | label_send_test_email: Send a test email |
|
416 | label_send_test_email: Send a test email | |
417 | label_feeds_access_key_created_on: RSS access key created %s ago |
|
417 | label_feeds_access_key_created_on: RSS access key created %s ago | |
|
418 | label_module_plural: Modules | |||
418 |
|
419 | |||
419 | button_login: Login |
|
420 | button_login: Login | |
420 | button_submit: Submit |
|
421 | button_submit: Submit | |
@@ -474,6 +475,7 text_comma_separated: Multiple values allowed (comma separated). | |||||
474 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages |
|
475 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages | |
475 | text_issue_added: Issue %s has been reported. |
|
476 | text_issue_added: Issue %s has been reported. | |
476 | text_issue_updated: Issue %s has been updated. |
|
477 | text_issue_updated: Issue %s has been updated. | |
|
478 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |||
477 |
|
479 | |||
478 | default_role_manager: Manager |
|
480 | default_role_manager: Manager | |
479 | default_role_developper: Developer |
|
481 | default_role_developper: Developer |
@@ -415,6 +415,7 label_language_based: Language based | |||||
415 | label_sort_by: Sort by "%s" |
|
415 | label_sort_by: Sort by "%s" | |
416 | label_send_test_email: Send a test email |
|
416 | label_send_test_email: Send a test email | |
417 | label_feeds_access_key_created_on: RSS access key created %s ago |
|
417 | label_feeds_access_key_created_on: RSS access key created %s ago | |
|
418 | label_module_plural: Modules | |||
418 |
|
419 | |||
419 | button_login: Conexión |
|
420 | button_login: Conexión | |
420 | button_submit: Someter |
|
421 | button_submit: Someter | |
@@ -474,6 +475,7 text_comma_separated: Multiple values allowed (comma separated). | |||||
474 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages |
|
475 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages | |
475 | text_issue_added: Issue %s has been reported. |
|
476 | text_issue_added: Issue %s has been reported. | |
476 | text_issue_updated: Issue %s has been updated. |
|
477 | text_issue_updated: Issue %s has been updated. | |
|
478 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |||
477 |
|
479 | |||
478 | default_role_manager: Manager |
|
480 | default_role_manager: Manager | |
479 | default_role_developper: Desarrollador |
|
481 | default_role_developper: Desarrollador |
@@ -415,6 +415,7 label_language_based: Basé sur la langue | |||||
415 | label_sort_by: Trier par "%s" |
|
415 | label_sort_by: Trier par "%s" | |
416 | label_send_test_email: Envoyer un email de test |
|
416 | label_send_test_email: Envoyer un email de test | |
417 | label_feeds_access_key_created_on: Clé d'accès RSS créée il y a %s |
|
417 | label_feeds_access_key_created_on: Clé d'accès RSS créée il y a %s | |
|
418 | label_module_plural: Modules | |||
418 |
|
419 | |||
419 | button_login: Connexion |
|
420 | button_login: Connexion | |
420 | button_submit: Soumettre |
|
421 | button_submit: Soumettre | |
@@ -474,6 +475,7 text_comma_separated: Plusieurs valeurs possibles (séparées par des virgules). | |||||
474 | text_issues_ref_in_commit_messages: Référencement et résolution des demandes dans les commentaires de commits |
|
475 | text_issues_ref_in_commit_messages: Référencement et résolution des demandes dans les commentaires de commits | |
475 | text_issue_added: La demande %s a été soumise. |
|
476 | text_issue_added: La demande %s a été soumise. | |
476 | text_issue_updated: La demande %s a été mise à jour. |
|
477 | text_issue_updated: La demande %s a été mise à jour. | |
|
478 | text_wiki_destroy_confirmation: Etes-vous sûr de vouloir supprimer ce wiki et tout son contenu ? | |||
477 |
|
479 | |||
478 | default_role_manager: Manager |
|
480 | default_role_manager: Manager | |
479 | default_role_developper: Développeur |
|
481 | default_role_developper: Développeur |
@@ -415,6 +415,7 label_language_based: Language based | |||||
415 | label_sort_by: Sort by "%s" |
|
415 | label_sort_by: Sort by "%s" | |
416 | label_send_test_email: Send a test email |
|
416 | label_send_test_email: Send a test email | |
417 | label_feeds_access_key_created_on: RSS access key created %s ago |
|
417 | label_feeds_access_key_created_on: RSS access key created %s ago | |
|
418 | label_module_plural: Modules | |||
418 |
|
419 | |||
419 | button_login: Login |
|
420 | button_login: Login | |
420 | button_submit: Invia |
|
421 | button_submit: Invia | |
@@ -474,6 +475,7 text_comma_separated: Multiple values allowed (comma separated). | |||||
474 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages |
|
475 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages | |
475 | text_issue_added: "E' stata segnalata l'anomalia %s." |
|
476 | text_issue_added: "E' stata segnalata l'anomalia %s." | |
476 | text_issue_updated: "L'anomalia %s e' stata aggiornata." |
|
477 | text_issue_updated: "L'anomalia %s e' stata aggiornata." | |
|
478 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |||
477 |
|
479 | |||
478 | default_role_manager: Manager |
|
480 | default_role_manager: Manager | |
479 | default_role_developper: Sviluppatore |
|
481 | default_role_developper: Sviluppatore |
@@ -416,6 +416,7 label_language_based: Language based | |||||
416 | label_sort_by: Sort by "%s" |
|
416 | label_sort_by: Sort by "%s" | |
417 | label_send_test_email: Send a test email |
|
417 | label_send_test_email: Send a test email | |
418 | label_feeds_access_key_created_on: RSS access key created %s ago |
|
418 | label_feeds_access_key_created_on: RSS access key created %s ago | |
|
419 | label_module_plural: Modules | |||
419 |
|
420 | |||
420 | button_login: ログイン |
|
421 | button_login: ログイン | |
421 | button_submit: 変更 |
|
422 | button_submit: 変更 | |
@@ -475,6 +476,7 text_comma_separated: (カンマで区切った)複数の値が使えます | |||||
475 | text_issues_ref_in_commit_messages: コミットメッセージ内で問題の参照/修正 |
|
476 | text_issues_ref_in_commit_messages: コミットメッセージ内で問題の参照/修正 | |
476 | text_issue_added: 問題 %s が報告されました。 |
|
477 | text_issue_added: 問題 %s が報告されました。 | |
477 | text_issue_updated: 問題 %s が更新されました。 |
|
478 | text_issue_updated: 問題 %s が更新されました。 | |
|
479 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |||
478 |
|
480 | |||
479 | default_role_manager: 管理者 |
|
481 | default_role_manager: 管理者 | |
480 | default_role_developper: 開発者 |
|
482 | default_role_developper: 開発者 |
@@ -415,6 +415,7 label_language_based: Language based | |||||
415 | label_sort_by: Sort by "%s" |
|
415 | label_sort_by: Sort by "%s" | |
416 | label_send_test_email: Send a test email |
|
416 | label_send_test_email: Send a test email | |
417 | label_feeds_access_key_created_on: RSS access key created %s ago |
|
417 | label_feeds_access_key_created_on: RSS access key created %s ago | |
|
418 | label_module_plural: Modules | |||
418 |
|
419 | |||
419 | button_login: Inloggen |
|
420 | button_login: Inloggen | |
420 | button_submit: Toevoegen |
|
421 | button_submit: Toevoegen | |
@@ -474,6 +475,7 text_coma_separated: Meerdere waarden toegestaan (door komma's gescheiden). | |||||
474 | text_issues_ref_in_commit_messages: Opzoeken en aanpassen van issues in commit berichten |
|
475 | text_issues_ref_in_commit_messages: Opzoeken en aanpassen van issues in commit berichten | |
475 | text_issue_added: Issue %s is gerapporteerd. |
|
476 | text_issue_added: Issue %s is gerapporteerd. | |
476 | text_issue_updated: Issue %s is gewijzigd. |
|
477 | text_issue_updated: Issue %s is gewijzigd. | |
|
478 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |||
477 |
|
479 | |||
478 | default_role_manager: Manager |
|
480 | default_role_manager: Manager | |
479 | default_role_developper: Ontwikkelaar |
|
481 | default_role_developper: Ontwikkelaar |
@@ -415,6 +415,7 label_language_based: Language based | |||||
415 | label_sort_by: Sort by "%s" |
|
415 | label_sort_by: Sort by "%s" | |
416 | label_send_test_email: Send a test email |
|
416 | label_send_test_email: Send a test email | |
417 | label_feeds_access_key_created_on: RSS access key created %s ago |
|
417 | label_feeds_access_key_created_on: RSS access key created %s ago | |
|
418 | label_module_plural: Modules | |||
418 |
|
419 | |||
419 | button_login: Login |
|
420 | button_login: Login | |
420 | button_submit: Enviar |
|
421 | button_submit: Enviar | |
@@ -474,6 +475,7 text_comma_separated: Multiple values allowed (comma separated). | |||||
474 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages |
|
475 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages | |
475 | text_issue_added: Tarefa %s foi incluída. |
|
476 | text_issue_added: Tarefa %s foi incluída. | |
476 | text_issue_updated: Tarefa %s foi alterada. |
|
477 | text_issue_updated: Tarefa %s foi alterada. | |
|
478 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |||
477 |
|
479 | |||
478 | default_role_manager: Analista de Negocio ou Gerente de Projeto |
|
480 | default_role_manager: Analista de Negocio ou Gerente de Projeto | |
479 | default_role_developper: Desenvolvedor |
|
481 | default_role_developper: Desenvolvedor |
@@ -415,6 +415,7 label_language_based: Language based | |||||
415 | label_sort_by: Sort by "%s" |
|
415 | label_sort_by: Sort by "%s" | |
416 | label_send_test_email: Send a test email |
|
416 | label_send_test_email: Send a test email | |
417 | label_feeds_access_key_created_on: RSS access key created %s ago |
|
417 | label_feeds_access_key_created_on: RSS access key created %s ago | |
|
418 | label_module_plural: Modules | |||
418 |
|
419 | |||
419 | button_login: Login |
|
420 | button_login: Login | |
420 | button_submit: Enviar |
|
421 | button_submit: Enviar | |
@@ -474,6 +475,7 text_comma_separated: Permitido múltiplos valores (separados por vírgula). | |||||
474 | text_issues_ref_in_commit_messages: Referenciando e arrumando tarefas nas mensagens de commit |
|
475 | text_issues_ref_in_commit_messages: Referenciando e arrumando tarefas nas mensagens de commit | |
475 | text_issue_added: Tarefa %s foi incluída. |
|
476 | text_issue_added: Tarefa %s foi incluída. | |
476 | text_issue_updated: Tarefa %s foi alterada. |
|
477 | text_issue_updated: Tarefa %s foi alterada. | |
|
478 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |||
477 |
|
479 | |||
478 | default_role_manager: Analista de Negócio ou Gerente de Projeto |
|
480 | default_role_manager: Analista de Negócio ou Gerente de Projeto | |
479 | default_role_developper: Desenvolvedor |
|
481 | default_role_developper: Desenvolvedor |
@@ -415,6 +415,7 label_language_based: Language based | |||||
415 | label_sort_by: Sort by "%s" |
|
415 | label_sort_by: Sort by "%s" | |
416 | label_send_test_email: Send a test email |
|
416 | label_send_test_email: Send a test email | |
417 | label_feeds_access_key_created_on: RSS access key created %s ago |
|
417 | label_feeds_access_key_created_on: RSS access key created %s ago | |
|
418 | label_module_plural: Modules | |||
418 |
|
419 | |||
419 | button_login: Logga in |
|
420 | button_login: Logga in | |
420 | button_submit: Skicka |
|
421 | button_submit: Skicka | |
@@ -474,6 +475,7 text_comma_separated: Multiple values allowed (comma separated). | |||||
474 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages |
|
475 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages | |
475 | text_issue_added: Brist %s har rapporterats. |
|
476 | text_issue_added: Brist %s har rapporterats. | |
476 | text_issue_updated: Brist %s har uppdaterats. |
|
477 | text_issue_updated: Brist %s har uppdaterats. | |
|
478 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |||
477 |
|
479 | |||
478 | default_role_manager: Förvaltare |
|
480 | default_role_manager: Förvaltare | |
479 | default_role_developper: Utvecklare |
|
481 | default_role_developper: Utvecklare |
@@ -417,6 +417,7 label_language_based: Language based | |||||
417 | label_sort_by: Sort by "%s" |
|
417 | label_sort_by: Sort by "%s" | |
418 | label_send_test_email: Send a test email |
|
418 | label_send_test_email: Send a test email | |
419 | label_feeds_access_key_created_on: RSS access key created %s ago |
|
419 | label_feeds_access_key_created_on: RSS access key created %s ago | |
|
420 | label_module_plural: Modules | |||
420 |
|
421 | |||
421 | button_login: 登录 |
|
422 | button_login: 登录 | |
422 | button_submit: 提交 |
|
423 | button_submit: 提交 | |
@@ -476,6 +477,7 text_comma_separated: Multiple values allowed (comma separated). | |||||
476 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages |
|
477 | text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages | |
477 | text_issue_added: %s ѱ |
|
478 | text_issue_added: %s ѱ | |
478 | text_issue_updated: %s Ѹ |
|
479 | text_issue_updated: %s Ѹ | |
|
480 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |||
479 |
|
481 | |||
480 | default_role_manager: 管理员 |
|
482 | default_role_manager: 管理员 | |
481 | default_role_developper: 开发人员 |
|
483 | default_role_developper: 开发人员 |
@@ -14,57 +14,76 REDMINE_SUPPORTED_SCM = %w( Subversion Darcs Mercurial Cvs ) | |||||
14 |
|
14 | |||
15 | # Permissions |
|
15 | # Permissions | |
16 | Redmine::AccessControl.map do |map| |
|
16 | Redmine::AccessControl.map do |map| | |
17 | # Project |
|
17 | map.permission :view_project, {:projects => [:show, :activity, :feeds]}, :public => true | |
18 | map.permission :view_project, {:projects => [:show, :activity, :changelog, :roadmap, :feeds]}, :public => true |
|
|||
19 | map.permission :search_project, {:search => :index}, :public => true |
|
18 | map.permission :search_project, {:search => :index}, :public => true | |
20 | map.permission :edit_project, {:projects => [:settings, :edit]}, :require => :member |
|
19 | map.permission :edit_project, {:projects => [:settings, :edit]}, :require => :member | |
21 |
map.permission : |
|
20 | map.permission :select_project_modules, {:projects => :modules}, :require => :member | |
|
21 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy]}, :require => :member | |||
22 | map.permission :manage_versions, {:projects => [:settings, :add_version], :versions => [:edit, :destroy]}, :require => :member |
|
22 | map.permission :manage_versions, {:projects => [:settings, :add_version], :versions => [:edit, :destroy]}, :require => :member | |
23 | map.permission :manage_categories, {:projects => [:settings, :add_issue_category], :issue_categories => [:edit, :destroy]}, :require => :member |
|
|||
24 |
|
23 | |||
25 | # Issues |
|
24 | map.project_module :issue_tracking do |map| | |
26 | map.permission :view_issues, {:projects => [:list_issues, :export_issues_csv, :export_issues_pdf], |
|
25 | # Issue categories | |
27 | :issues => [:show, :export_pdf], |
|
26 | map.permission :manage_categories, {:projects => [:settings, :add_issue_category], :issue_categories => [:edit, :destroy]}, :require => :member | |
28 | :queries => :index, |
|
27 | # Issues | |
29 | :reports => :issue_report}, :public => true |
|
28 | map.permission :view_issues, {:projects => [:list_issues, :export_issues_csv, :export_issues_pdf, :changelog, :roadmap], | |
30 | map.permission :add_issues, {:projects => :add_issue}, :require => :loggedin |
|
29 | :issues => [:show, :export_pdf], | |
31 | map.permission :edit_issues, {:issues => [:edit, :destroy_attachment]}, :require => :loggedin |
|
30 | :queries => :index, | |
32 | map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}, :require => :loggedin |
|
31 | :reports => :issue_report}, :public => true | |
33 |
map.permission :add_issue |
|
32 | map.permission :add_issues, {:projects => :add_issue}, :require => :loggedin | |
34 |
map.permission : |
|
33 | map.permission :edit_issues, {:issues => [:edit, :destroy_attachment]}, :require => :loggedin | |
35 |
map.permission :m |
|
34 | map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}, :require => :loggedin | |
36 |
map.permission : |
|
35 | map.permission :add_issue_notes, {:issues => :add_note}, :require => :loggedin | |
37 | # Queries |
|
36 | map.permission :change_issue_status, {:issues => :change_status}, :require => :loggedin | |
38 |
map.permission :m |
|
37 | map.permission :move_issues, {:projects => :move_issues}, :require => :loggedin | |
39 |
map.permission : |
|
38 | map.permission :delete_issues, {:issues => :destroy}, :require => :member | |
40 | # Gantt & calendar |
|
39 | # Queries | |
41 | map.permission :view_gantt, :projects => :gantt |
|
40 | map.permission :manage_pulic_queries, {:queries => [:new, :edit, :destroy]}, :require => :member | |
42 | map.permission :view_calendar, :projects => :calendar |
|
41 | map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin | |
43 | # Time tracking |
|
42 | # Gantt & calendar | |
44 | map.permission :log_time, {:timelog => :edit}, :require => :loggedin |
|
43 | map.permission :view_gantt, :projects => :gantt | |
45 |
map.permission :view_ |
|
44 | map.permission :view_calendar, :projects => :calendar | |
46 | # News |
|
45 | end | |
47 | map.permission :view_news, {:projects => :list_news, :news => :show}, :public => true |
|
46 | ||
48 | map.permission :manage_news, {:projects => :add_news, :news => [:edit, :destroy, :destroy_comment]}, :require => :member |
|
47 | map.project_module :time_tracking do |map| | |
49 |
map.permission : |
|
48 | map.permission :log_time, {:timelog => :edit}, :require => :loggedin | |
50 | # Documents |
|
49 | map.permission :view_time_entries, :timelog => [:details, :report] | |
51 | map.permission :view_documents, :projects => :list_documents, :documents => [:show, :download] |
|
50 | end | |
52 | map.permission :manage_documents, {:projects => :add_document, :documents => [:edit, :destroy, :add_attachment, :destroy_attachment]}, :require => :loggedin |
|
51 | ||
53 | # Wiki |
|
52 | map.project_module :news do |map| | |
54 | map.permission :view_wiki_pages, :wiki => [:index, :history, :diff, :special] |
|
53 | map.permission :manage_news, {:projects => :add_news, :news => [:edit, :destroy, :destroy_comment]}, :require => :member | |
55 | map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment, :destroy_attachment] |
|
54 | map.permission :view_news, {:projects => :list_news, :news => :show}, :public => true | |
56 |
map.permission : |
|
55 | map.permission :comment_news, {:news => :add_comment}, :require => :loggedin | |
57 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member |
|
56 | end | |
58 | # Message boards |
|
57 | ||
59 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true |
|
58 | map.project_module :documents do |map| | |
60 | map.permission :add_messages, {:messages => [:new, :reply]}, :require => :loggedin |
|
59 | map.permission :manage_documents, {:projects => :add_document, :documents => [:edit, :destroy, :add_attachment, :destroy_attachment]}, :require => :loggedin | |
61 | map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member |
|
60 | map.permission :view_documents, :projects => :list_documents, :documents => [:show, :download] | |
62 | # Files |
|
61 | end | |
63 | map.permission :view_files, :projects => :list_files, :versions => :download |
|
62 | ||
64 | map.permission :manage_files, {:projects => :add_file, :versions => :destroy_file}, :require => :loggedin |
|
63 | map.project_module :files do |map| | |
65 | # Repository |
|
64 | map.permission :manage_files, {:projects => :add_file, :versions => :destroy_file}, :require => :loggedin | |
66 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :changes, :diff, :stats, :graph] |
|
65 | map.permission :view_files, :projects => :list_files, :versions => :download | |
67 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] |
|
66 | end | |
|
67 | ||||
|
68 | map.project_module :wiki do |map| | |||
|
69 | map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member | |||
|
70 | map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member | |||
|
71 | map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member | |||
|
72 | map.permission :view_wiki_pages, :wiki => [:index, :history, :diff, :special] | |||
|
73 | map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment, :destroy_attachment] | |||
|
74 | end | |||
|
75 | ||||
|
76 | map.project_module :repository do |map| | |||
|
77 | map.permission :manage_repository, :repositories => [:edit, :destroy] | |||
|
78 | map.permission :browse_repository, :repositories => [:show, :browse, :entry, :changes, :diff, :stats, :graph] | |||
|
79 | map.permission :view_changesets, :repositories => [:show, :revisions, :revision] | |||
|
80 | end | |||
|
81 | ||||
|
82 | map.project_module :boards do |map| | |||
|
83 | map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member | |||
|
84 | map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true | |||
|
85 | map.permission :add_messages, {:messages => [:new, :reply]}, :require => :loggedin | |||
|
86 | end | |||
68 | end |
|
87 | end | |
69 |
|
88 | |||
70 | # Project menu configuration |
|
89 | # Project menu configuration |
@@ -46,27 +46,47 module Redmine | |||||
46 | def loggedin_only_permissions |
|
46 | def loggedin_only_permissions | |
47 | @loggedin_only_permissions ||= @permissions.select {|p| p.require_loggedin?} |
|
47 | @loggedin_only_permissions ||= @permissions.select {|p| p.require_loggedin?} | |
48 | end |
|
48 | end | |
|
49 | ||||
|
50 | def available_project_modules | |||
|
51 | @available_project_modules ||= @permissions.collect(&:project_module).uniq.compact | |||
|
52 | end | |||
|
53 | ||||
|
54 | def modules_permissions(modules) | |||
|
55 | @permissions.select {|p| p.project_module.nil? || modules.include?(p.project_module.to_s)} | |||
|
56 | end | |||
49 | end |
|
57 | end | |
50 |
|
58 | |||
51 | class Mapper |
|
59 | class Mapper | |
|
60 | def initialize | |||
|
61 | @project_module = nil | |||
|
62 | end | |||
|
63 | ||||
52 | def permission(name, hash, options={}) |
|
64 | def permission(name, hash, options={}) | |
53 | @permissions ||= [] |
|
65 | @permissions ||= [] | |
|
66 | options.merge!(:project_module => @project_module) | |||
54 | @permissions << Permission.new(name, hash, options) |
|
67 | @permissions << Permission.new(name, hash, options) | |
55 | end |
|
68 | end | |
56 |
|
69 | |||
|
70 | def project_module(name, options={}) | |||
|
71 | @project_module = name | |||
|
72 | yield self | |||
|
73 | @project_module = nil | |||
|
74 | end | |||
|
75 | ||||
57 | def mapped_permissions |
|
76 | def mapped_permissions | |
58 | @permissions |
|
77 | @permissions | |
59 | end |
|
78 | end | |
60 | end |
|
79 | end | |
61 |
|
80 | |||
62 | class Permission |
|
81 | class Permission | |
63 | attr_reader :name, :actions |
|
82 | attr_reader :name, :actions, :project_module | |
64 |
|
83 | |||
65 | def initialize(name, hash, options) |
|
84 | def initialize(name, hash, options) | |
66 | @name = name |
|
85 | @name = name | |
67 | @actions = [] |
|
86 | @actions = [] | |
68 | @public = options[:public] || false |
|
87 | @public = options[:public] || false | |
69 | @require = options[:require] |
|
88 | @require = options[:require] | |
|
89 | @project_module = options[:project_module] | |||
70 | hash.each do |controller, actions| |
|
90 | hash.each do |controller, actions| | |
71 | if actions.is_a? Array |
|
91 | if actions.is_a? Array | |
72 | @actions << actions.collect {|action| "#{controller}/#{action}"} |
|
92 | @actions << actions.collect {|action| "#{controller}/#{action}"} |
@@ -31,8 +31,8 module Redmine | |||||
31 | @items[menu_name.to_sym] || [] |
|
31 | @items[menu_name.to_sym] || [] | |
32 | end |
|
32 | end | |
33 |
|
33 | |||
34 |
def allowed_items(menu_name, |
|
34 | def allowed_items(menu_name, user, project) | |
35 |
items(menu_name).select {|item| |
|
35 | items(menu_name).select {|item| user && user.allowed_to?(item.url, project)} | |
36 | end |
|
36 | end | |
37 | end |
|
37 | end | |
38 |
|
38 |
@@ -22,7 +22,7 require 'projects_controller' | |||||
22 | class ProjectsController; def rescue_action(e) raise e end; end |
|
22 | class ProjectsController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class ProjectsControllerTest < Test::Unit::TestCase |
|
24 | class ProjectsControllerTest < Test::Unit::TestCase | |
25 | fixtures :projects, :users, :roles |
|
25 | fixtures :projects, :users, :roles, :enabled_modules | |
26 |
|
26 | |||
27 | def setup |
|
27 | def setup | |
28 | @controller = ProjectsController.new |
|
28 | @controller = ProjectsController.new |
@@ -18,7 +18,7 | |||||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 | class MailHandlerTest < Test::Unit::TestCase |
|
20 | class MailHandlerTest < Test::Unit::TestCase | |
21 | fixtures :users, :projects, :roles, :members, :issues, :trackers, :enumerations |
|
21 | fixtures :users, :projects, :enabled_modules, :roles, :members, :issues, :trackers, :enumerations | |
22 |
|
22 | |||
23 | FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures' |
|
23 | FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures' | |
24 | CHARSET = "utf-8" |
|
24 | CHARSET = "utf-8" |
@@ -58,7 +58,7 class WatcherTest < Test::Unit::TestCase | |||||
58 | @user.mail_notification = false |
|
58 | @user.mail_notification = false | |
59 | @user.save |
|
59 | @user.save | |
60 | @issue.reload |
|
60 | @issue.reload | |
61 |
assert |
|
61 | assert @issue.watcher_recipients.include?(@user.mail) | |
62 | end |
|
62 | end | |
63 |
|
63 | |||
64 | def test_unwatch |
|
64 | def test_unwatch |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now