foreman-tasks 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bded348bac199b96bf0c1bf458c0785cdc233892acc1a5d06a940a8c5b28309b
4
- data.tar.gz: f90eaf365ebfb191b45ab12b4693c7253d829ffcf0c57192e8bb4c1fa3e51986
3
+ metadata.gz: 9bb66102c3571249534dc929d2f1515666d393d4d9f7987c098e529849bfeca7
4
+ data.tar.gz: 01c53850b401aaf7c50f4807a5947956bdfe0fa99582c778bd615fba922286f9
5
5
  SHA512:
6
- metadata.gz: 41d60c3a188d66c0f7f3e9982c72de16f323d458529e2b90a16e8c023733acaedcf94a09ae30e94e54a66f4303f0b904a06d54c33b6db2af3acf49669c8b8b0f
7
- data.tar.gz: b0ec169bf37128b471263c189b839416d8ae572a69732d3a9d4dcb64d4e2cdf2aef53d423cb2a7eef1c5f50f0756d332066dc9a244788f2b8c05643e1ca73b0f
6
+ metadata.gz: bc272bf14fd55504672179272d3b26123b0d3c68cc6ddd97a8181bf9cfc1dd257e809501b9cb4d94cfe5730e8098c2fa0232fe26b35d227921520a66d976ae39
7
+ data.tar.gz: 4b264080240f04e2544af9d026026df2c70f126f4168cef1f74a21fd0d810c21b7696f8fc7520c107d4402ea5bfad0762c75c93d6679c841e406e4d0898c23bd
@@ -253,10 +253,7 @@ module ForemanTasks
253
253
  if search_params[:user_id].blank?
254
254
  raise BadRequest, _('User search_params requires user_id to be specified')
255
255
  end
256
- scope.joins(:locks).where(foreman_tasks_locks:
257
- { name: ::ForemanTasks::Lock::OWNER_LOCK_NAME,
258
- resource_type: 'User',
259
- resource_id: search_params[:user_id] })
256
+ scope.search_for("user_id = #{search_params[:user_id]}")
260
257
  when 'resource'
261
258
  if search_params[:resource_type].blank? || search_params[:resource_id].blank?
262
259
  raise BadRequest,
@@ -70,7 +70,7 @@ module Actions
70
70
  apipie :class, "An common ancestor action for observable actions" do
71
71
  name 'Actions::ObservableAction'
72
72
  refs 'Actions::ObservableAction'
73
- sections only: %w[webhooks]
73
+ sections only: %w[all webhooks]
74
74
  property :task, object_of: 'Task', desc: 'Returns the task to which this action belongs'
75
75
  end
76
76
  class Jail < Safemode::Jail
@@ -1,4 +1,6 @@
1
1
  class AddUserId < ActiveRecord::Migration[5.0]
2
+ OWNER_LOCK_NAME = :task_owner
3
+
2
4
  def up
3
5
  add_reference :foreman_tasks_tasks, :user, :foreign_key => true
4
6
 
@@ -29,7 +31,7 @@ class AddUserId < ActiveRecord::Migration[5.0]
29
31
  private
30
32
 
31
33
  def create_lock(user_id, task)
32
- ForemanTasks::Lock.new(:name => ForemanTasks::Lock::OWNER_LOCK_NAME,
34
+ ForemanTasks::Lock.new(:name => OWNER_LOCK_NAME,
33
35
  :resource_type => User.name,
34
36
  :resource_id => user_id,
35
37
  :task_id => task.id,
@@ -37,6 +39,6 @@ class AddUserId < ActiveRecord::Migration[5.0]
37
39
  end
38
40
 
39
41
  def user_locks
40
- ForemanTasks::Lock.where(:name => ForemanTasks::Lock::OWNER_LOCK_NAME)
42
+ ForemanTasks::Lock.where(:name => OWNER_LOCK_NAME)
41
43
  end
42
44
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '4.0.0'.freeze
2
+ VERSION = '4.0.1'.freeze
3
3
  end
@@ -29,7 +29,7 @@ module ForemanTasks
29
29
 
30
30
  it 'renders task ids when searching by resource id' do
31
31
  task = FactoryBot.create(:dynflow_task, :product_create_task)
32
- ForemanTasks::Lock.create!(name: "create", resource_type: "Katello::Product", resource_id: 1, task_id: task.id)
32
+ ForemanTasks::Link.create!(resource_type: "Katello::Product", resource_id: 1, task_id: task.id)
33
33
  get :index, params: { :search => "label = Actions::Katello::Product::Create and resource_id = 1" }
34
34
  assert_response :success
35
35
  data = JSON.parse(response.body)
@@ -44,8 +44,8 @@ module ForemanTasks
44
44
  @locations = [0, 0].map { FactoryBot.create(:location) }
45
45
  @tasks = [0, 0].map { FactoryBot.create(:some_task) }
46
46
  @tasks.zip(@organizations, @locations).each do |task, org, loc|
47
- Lock.link!(org, task.id)
48
- Lock.link!(loc, task.id)
47
+ Link.link!(org, task)
48
+ Link.link!(loc, task)
49
49
  end
50
50
  end
51
51
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman-tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-02 00:00:00.000000000 Z
11
+ date: 2021-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynflow