Defect #41465 » import_time_entry.patch
| app/models/time_entry_import.rb | ||
|---|---|---|
|
end
|
||
|
|
||
|
def self.authorized?(user)
|
||
|
user.allowed_to?(:import_time_entries, nil, :global => true)
|
||
|
user.allowed_to?(:import_time_entries, nil, :global => true) && user.allowed_to?(:log_time, nil, :global => true)
|
||
|
end
|
||
|
|
||
|
# Returns the objects that were imported
|
||
| app/views/timelog/index.html.erb | ||
|---|---|---|
|
_new_time_entry_path(@project, @query.filtered_issue_id),
|
||
|
:class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project, :global => true) %>
|
||
|
<%= actions_dropdown do %>
|
||
|
<% if User.current.allowed_to?(:import_time_entries, @project, :global => true) %>
|
||
|
<% if User.current.allowed_to?(:import_time_entries, @project, :global => true) && User.current.allowed_to?(:log_time, @project, :global => true) %>
|
||
|
<%= link_to icon_with_label('import', l(:button_import)), new_time_entries_import_path(:project_id => @project), :class => 'icon icon-import' %>
|
||
|
<% end %>
|
||
|
|
||
| test/functional/imports_controller_test.rb | ||
|---|---|---|
|
assert_select 'input[name=?][type=?][value=?]', 'project_id', 'hidden', 'subproject1'
|
||
|
end
|
||
|
|
||
|
def test_new_time_entry_import_without_log_time_permission
|
||
|
Role.all.map { |role| role.remove_permission! :log_time }
|
||
|
get(:new, :params => {:type => 'TimeEntryImport', :project_id => 'subproject1'})
|
||
|
assert_response :forbidden
|
||
|
end
|
||
|
|
||
|
def test_create_should_save_the_file
|
||
|
import = new_record(Import) do
|
||
|
post(
|
||
|
-
|
||