Project

General

Profile

Patch #3461 » redmine-1.0.4-issue-assignment-permission.patch

Arne-Kolja Bachstein, 2010-12-15 16:35

View differences:

app/models/issue.rb
15 15
# along with this program; if not, write to the Free Software
16 16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 17

  
18
# @arnekolja
19
# ToDo: check against permission_manage_issue_assignment
18 20
class Issue < ActiveRecord::Base
19 21
  belongs_to :project
20 22
  belongs_to :tracker
app/models/query.rb
274 274
    label ||= field.gsub(/\_id$/, "")
275 275
  end
276 276

  
277
  # @arnekolja
278
  # Total rewrite to reject not allowed column. Only last line is still the same.
277 279
  def available_columns
278
    return @available_columns if @available_columns
279
    @available_columns = Query.available_columns
280
    @available_columns = (@available_columns) ? @available_columns : Query.available_columns
281
    @available_columns.reject! {|c| c.name == :assigned_to} unless User.current.allowed_to?(:view_issue_assignment, @project)
282
    
280 283
    @available_columns += (project ? 
281 284
                            project.all_issue_custom_fields :
282 285
                            IssueCustomField.find(:all)
app/views/issues/_attributes.rhtml
8 8
<% end %>
9 9

  
10 10
<p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), {:required => true}, :disabled => !@issue.leaf? %></p>
11
<p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p>
11
<% if User.current.allowed_to?(:manage_issue_assignment, @project) -%>
12
  <p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p>
13
<% else %>
14
  <% if User.current.allowed_to?(:view_issue_assignment, @project) -%>
15
    <p><label><%=l(:field_assigned_to)%></label><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></p>
16
  <% end %>
17
<% end %>
12 18
<% unless @project.issue_categories.empty? %>
13 19
<p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %>
14 20
<%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'),
app/views/issues/show.rhtml
25 25
    <th class="due-date"><%=l(:field_due_date)%>:</th><td class="due-date"><%= format_date(@issue.due_date) %></td>
26 26
</tr>
27 27
<tr>
28
    <th class="assigned-to"><%=l(:field_assigned_to)%>:</th><td class="assigned-to"><%= avatar(@issue.assigned_to, :size => "14") %><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td>
28
    <% if User.current.allowed_to?(:view_issue_assignment, @project) -%>
29
        <th class="assigned-to"><%=l(:field_assigned_to)%>:</th><td class="assigned-to"><%= avatar(@issue.assigned_to, :size => "14") %><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td>
30
    <% end %>
29 31
    <th class="progress"><%=l(:field_done_ratio)%>:</th><td class="progress"><%= progress_bar @issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%" %></td>
30 32
</tr>
31 33
<tr>
lib/redmine.rb
67 67
    map.permission :add_issues, {:issues => [:new, :create, :update_form]}
68 68
    map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new]}
69 69
    map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}
70
    map.permission :manage_issue_assignment, {} # @arnekolja
71
    map.permission :view_issue_assignment, {} # @arnekolja
70 72
    map.permission :manage_subtasks, {}
71 73
    map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new]}
72 74
    map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin
config/locales/de.yml
378 378
 permission_add_issues: Tickets hinzufügen
379 379
 permission_edit_issues: Tickets bearbeiten
380 380
 permission_manage_issue_relations: Ticket-Beziehungen verwalten
381
  permission_manage_issue_assignment: Ticket-Zuweisungen verwalten
382
  permission_view_issue_assignment: Ticket-Zuweisungen anzeigen  
381 383
 permission_add_issue_notes: Kommentare hinzufügen
382 384
 permission_edit_issue_notes: Kommentare bearbeiten
383 385
 permission_edit_own_issue_notes: Eigene Kommentare bearbeiten
config/locales/en-GB.yml
354 354
 permission_add_issues: Add issues
355 355
 permission_edit_issues: Edit issues
356 356
 permission_manage_issue_relations: Manage issue relations
357
  permission_manage_issue_assignment: Manage issue assignments
358
  permission_view_issue_assignment: View issue assignments
357 359
 permission_add_issue_notes: Add notes
358 360
 permission_edit_issue_notes: Edit notes
359 361
 permission_edit_own_issue_notes: Edit own notes
config/locales/en.yml
363 363
 permission_add_issues: Add issues
364 364
 permission_edit_issues: Edit issues
365 365
 permission_manage_issue_relations: Manage issue relations
366
  permission_manage_issue_assignment: Manage issue assignments
367
  permission_view_issue_assignment: View issue assignments
366 368
 permission_add_issue_notes: Add notes
367 369
 permission_edit_issue_notes: Edit notes
368 370
 permission_edit_own_issue_notes: Edit own notes
(3-3/3)