[#735] Log time form on issue update should only be displayed with log_time permission
Based on a patch by Jean-Philippe Lang.
This commit is contained in:
parent
59dc103492
commit
24538a4af2
|
@ -15,7 +15,7 @@
|
|||
<%= render :partial => (@edit_allowed ? 'form' : 'form_update'), :locals => {:f => f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% if authorize_for('timelog', 'edit') %>
|
||||
<% if User.current.allowed_to?(:log_time, @project) %>
|
||||
<fieldset class="tabular"><legend><%= l(:button_log_time) %></legend>
|
||||
<% fields_for :time_entry, @time_entry, { :builder => TabularFormBuilder, :lang => current_language} do |time_entry| %>
|
||||
<div class="splitcontentleft">
|
||||
|
@ -26,7 +26,7 @@
|
|||
</div>
|
||||
<p><%= time_entry.text_field :comments, :size => 60 %></p>
|
||||
<% @time_entry.custom_field_values.each do |value| %>
|
||||
<p><%= custom_field_tag_with_label :time_entry, value %></p>
|
||||
<p><%= custom_field_tag_with_label :time_entry, value %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
|
|
|
@ -781,6 +781,22 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
assert_tag :input, :attributes => { :name => 'time_entry[comments]', :value => 'test_get_edit_with_params' }
|
||||
end
|
||||
|
||||
def test_get_edit_should_display_the_time_entry_form_with_log_time_permission
|
||||
@request.session[:user_id] = 2
|
||||
Role.find_by_name('Manager').update_attribute :permissions, [:view_issues, :edit_issues, :log_time]
|
||||
|
||||
get :edit, :id => 1
|
||||
assert_tag 'input', :attributes => {:name => 'time_entry[hours]'}
|
||||
end
|
||||
|
||||
def test_get_edit_should_not_display_the_time_entry_form_without_log_time_permission
|
||||
@request.session[:user_id] = 2
|
||||
Role.find_by_name('Manager').remove_permission! :log_time
|
||||
|
||||
get :edit, :id => 1
|
||||
assert_no_tag 'input', :attributes => {:name => 'time_entry[hours]'}
|
||||
end
|
||||
|
||||
def test_update_edit_form
|
||||
@request.session[:user_id] = 2
|
||||
xhr :post, :new, :project_id => 1,
|
||||
|
|
Loading…
Reference in New Issue