forest_liana 7.4.1 → 7.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f6d7b1f15f9049662a8a2275159a353fe9430460a6057c18af99fb3b23e9ccb
4
- data.tar.gz: 5f10ad94306023a27b17921225f7df4f25ac5e97e37c0d4e5be0220a6f57038b
3
+ metadata.gz: '081fe9fbe4eb7375a7e0a613b55ad7fb51b95ab787df36f6fc7c7078c7ae2a5f'
4
+ data.tar.gz: 89c350e886e097d3624ded4025dce3a2b25dd06836354908f152283e0dbe5126
5
5
  SHA512:
6
- metadata.gz: edb8fa9ca2626c71fe716c8ea79f98015c0333ee7d0b178098170673ac3535cdfbaf56b0d00fee5a8e4d168ea4d7b8f69fd06eeb8e517e096d2d25669a4982cd
7
- data.tar.gz: 7d40c81c9cf17a84444f696cd977549629b9d5bfd0c94241e81bfb564e8b3ac9a858bd016265ceccc89d4a9bb176b364b3ee75b3bf76aa014d15f80173589a09
6
+ metadata.gz: a79ae6c586f14c4437904c1d4186712a248bd65727851d48d9a80ee5d9754cbfc323fd3aac2715b79b08b7df62a353fc95d48ddb2fd998e5ea3167a9dec3a49d
7
+ data.tar.gz: 44a947d09db5e6a6e6a299ff6b4615417262af919bb515fd2466e29edd54af065c15ca16f93556e6a9b5f55ef596016b7af497160e6d4c30920c02ea8e0d1f37
@@ -32,7 +32,7 @@ module ForestLiana
32
32
  field[:value] = nil unless field[:value]
33
33
  field
34
34
  end
35
- {:fields => fields, :params => params}
35
+ {:fields => fields, :params => params, :user => forest_user}
36
36
  end
37
37
 
38
38
  def get_smart_action_change_ctx(fields, field_changed)
@@ -42,7 +42,7 @@ module ForestLiana
42
42
  ForestLiana::WidgetsHelper.set_field_widget(field)
43
43
  field
44
44
  end
45
- {:field_changed => found_field_changed, :fields => fields, :params => params}
45
+ {:field_changed => found_field_changed, :fields => fields, :params => params, :user => forest_user}
46
46
  end
47
47
 
48
48
  def handle_result(result, action)
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "7.4.1"
2
+ VERSION = "7.4.2"
3
3
  end
@@ -0,0 +1 @@
1
+ o: ActiveSupport::Cache::Entry : @value{:client_idI"random_id:ET: issuerI"api.forestadmin.com;T:
@@ -136,13 +136,26 @@ describe 'Requesting Actions routes', :type => :request do
136
136
  }
137
137
  }
138
138
 
139
+ use_user_context_action_definition = {
140
+ name: 'use_user_context',
141
+ fields: [foo],
142
+ hooks: {
143
+ :load => -> (context) {
144
+ foo = context[:fields].find{|field| field[:field] == 'foo'}
145
+ foo[:value] = context[:user]['first_name']
146
+ context[:fields]
147
+ }
148
+ }
149
+ }
150
+
139
151
  action = ForestLiana::Model::Action.new(action_definition)
140
152
  fail_action = ForestLiana::Model::Action.new(fail_action_definition)
141
153
  cheat_action = ForestLiana::Model::Action.new(cheat_action_definition)
142
154
  enums_action = ForestLiana::Model::Action.new(enums_action_definition)
143
155
  multiple_enums_action = ForestLiana::Model::Action.new(multiple_enums_action_definition)
156
+ use_user_context_action = ForestLiana::Model::Action.new(use_user_context_action_definition)
144
157
  island = ForestLiana.apimap.find {|collection| collection.name.to_s == ForestLiana.name_for(Island)}
145
- island.actions = [action, fail_action, cheat_action, enums_action, multiple_enums_action]
158
+ island.actions = [action, fail_action, cheat_action, enums_action, multiple_enums_action, use_user_context_action]
146
159
 
147
160
  describe 'call /load' do
148
161
  params = {
@@ -174,6 +187,12 @@ describe 'Requesting Actions routes', :type => :request do
174
187
  expect(response.status).to eq(500)
175
188
  expect(JSON.parse(response.body)).to eq({'error' => 'Error in smart action load hook: hook must return an array of fields'})
176
189
  end
190
+
191
+ it 'should return the first_name of the user who call the action' do
192
+ post '/forest/actions/use_user_context/hooks/load', params: JSON.dump(params), headers: headers
193
+ expect(response.status).to eq(200)
194
+ expect(JSON.parse(response.body)).to eq({'fields' => [foo.merge({:value => 'Michael'}).transform_keys { |key| key.to_s.camelize(:lower) }.stringify_keys]})
195
+ end
177
196
  end
178
197
 
179
198
  describe 'call /change' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.4.1
4
+ version: 7.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-22 00:00:00.000000000 Z
11
+ date: 2021-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -372,6 +372,7 @@ files:
372
372
  - spec/dummy/lib/forest_liana/collections/island.rb
373
373
  - spec/dummy/lib/forest_liana/collections/location.rb
374
374
  - spec/dummy/lib/forest_liana/collections/user.rb
375
+ - spec/dummy/tmp/cache/11D/A92/http%3A%2F%2Flocalhost%3A3000%2Fforest%2Fauthentication%2Fcallback-env_secret_test-client-data
375
376
  - spec/helpers/forest_liana/query_helper_spec.rb
376
377
  - spec/helpers/forest_liana/schema_helper_spec.rb
377
378
  - spec/lib/forest_liana/bootstrapper_spec.rb
@@ -510,171 +511,172 @@ signing_key:
510
511
  specification_version: 4
511
512
  summary: Official Rails Liana for Forest
512
513
  test_files:
514
+ - test/test_helper.rb
515
+ - test/services/forest_liana/operator_date_interval_parser_test.rb
516
+ - test/services/forest_liana/schema_adapter_test.rb
517
+ - test/routing/route_test.rb
518
+ - test/forest_liana_test.rb
519
+ - test/dummy/Rakefile
520
+ - test/dummy/bin/setup
521
+ - test/dummy/bin/bundle
522
+ - test/dummy/bin/rake
523
+ - test/dummy/bin/rails
513
524
  - test/dummy/db/schema.rb
514
- - test/dummy/db/migrate/20160627172951_create_tree.rb
515
- - test/dummy/db/migrate/20150623115554_create_has_many_class_name_field.rb
516
- - test/dummy/db/migrate/20170614141921_create_serialize_field.rb
517
- - test/dummy/db/migrate/20150608133044_create_has_one_field.rb
518
- - test/dummy/db/migrate/20150608130516_create_date_field.rb
519
525
  - test/dummy/db/migrate/20150608131603_create_decimal_field.rb
526
+ - test/dummy/db/migrate/20150814081918_create_has_many_through_field.rb
527
+ - test/dummy/db/migrate/20160627172951_create_tree.rb
520
528
  - test/dummy/db/migrate/20160628173505_add_timestamps.rb
521
- - test/dummy/db/migrate/20150616150629_create_polymorphic_field.rb
522
- - test/dummy/db/migrate/20150608131430_create_integer_field.rb
523
- - test/dummy/db/migrate/20150609114636_create_belongs_to_class_name_field.rb
529
+ - test/dummy/db/migrate/20150608130516_create_date_field.rb
524
530
  - test/dummy/db/migrate/20181111162121_create_references_table.rb
525
531
  - test/dummy/db/migrate/20160627172810_create_owner.rb
526
- - test/dummy/db/migrate/20150608131610_create_float_field.rb
527
- - test/dummy/db/migrate/20150612112520_create_has_and_belongs_to_many_field.rb
528
532
  - test/dummy/db/migrate/20150608132621_create_string_field.rb
529
- - test/dummy/db/migrate/20150608132159_create_boolean_field.rb
533
+ - test/dummy/db/migrate/20150609114636_create_belongs_to_class_name_field.rb
534
+ - test/dummy/db/migrate/20150616150629_create_polymorphic_field.rb
530
535
  - test/dummy/db/migrate/20150608133038_create_belongs_to_field.rb
531
- - test/dummy/db/migrate/20150814081918_create_has_many_through_field.rb
536
+ - test/dummy/db/migrate/20150608133044_create_has_one_field.rb
537
+ - test/dummy/db/migrate/20150608131610_create_float_field.rb
532
538
  - test/dummy/db/migrate/20150608150016_create_has_many_field.rb
539
+ - test/dummy/db/migrate/20150608132159_create_boolean_field.rb
540
+ - test/dummy/db/migrate/20170614141921_create_serialize_field.rb
541
+ - test/dummy/db/migrate/20150623115554_create_has_many_class_name_field.rb
542
+ - test/dummy/db/migrate/20150612112520_create_has_and_belongs_to_many_field.rb
543
+ - test/dummy/db/migrate/20150608131430_create_integer_field.rb
533
544
  - test/dummy/config.ru
534
- - test/dummy/Rakefile
535
- - test/dummy/app/controllers/application_controller.rb
545
+ - test/dummy/README.rdoc
546
+ - test/dummy/config/environment.rb
547
+ - test/dummy/config/locales/en.yml
548
+ - test/dummy/config/database.yml
549
+ - test/dummy/config/environments/production.rb
550
+ - test/dummy/config/environments/test.rb
551
+ - test/dummy/config/environments/development.rb
552
+ - test/dummy/config/routes.rb
553
+ - test/dummy/config/secrets.yml
554
+ - test/dummy/config/initializers/backtrace_silencers.rb
555
+ - test/dummy/config/initializers/wrap_parameters.rb
556
+ - test/dummy/config/initializers/mime_types.rb
557
+ - test/dummy/config/initializers/cookies_serializer.rb
558
+ - test/dummy/config/initializers/inflections.rb
559
+ - test/dummy/config/initializers/filter_parameter_logging.rb
560
+ - test/dummy/config/initializers/session_store.rb
561
+ - test/dummy/config/initializers/assets.rb
562
+ - test/dummy/config/application.rb
563
+ - test/dummy/config/boot.rb
536
564
  - test/dummy/app/helpers/application_helper.rb
565
+ - test/dummy/app/models/belongs_to_field.rb
566
+ - test/dummy/app/models/tree.rb
537
567
  - test/dummy/app/models/boolean_field.rb
538
- - test/dummy/app/models/decimal_field.rb
539
- - test/dummy/app/models/has_many_field.rb
540
- - test/dummy/app/models/float_field.rb
568
+ - test/dummy/app/models/polymorphic_field.rb
541
569
  - test/dummy/app/models/reference.rb
542
- - test/dummy/app/models/belongs_to_field.rb
543
570
  - test/dummy/app/models/belongs_to_class_name_field.rb
544
- - test/dummy/app/models/owner.rb
545
- - test/dummy/app/models/has_many_class_name_field.rb
546
- - test/dummy/app/models/has_many_through_field.rb
547
571
  - test/dummy/app/models/integer_field.rb
548
- - test/dummy/app/models/tree.rb
549
572
  - test/dummy/app/models/date_field.rb
550
- - test/dummy/app/models/has_and_belongs_to_many_field.rb
551
- - test/dummy/app/models/polymorphic_field.rb
552
573
  - test/dummy/app/models/serialize_field.rb
574
+ - test/dummy/app/models/decimal_field.rb
575
+ - test/dummy/app/models/owner.rb
576
+ - test/dummy/app/models/has_many_field.rb
577
+ - test/dummy/app/models/has_many_class_name_field.rb
553
578
  - test/dummy/app/models/string_field.rb
554
579
  - test/dummy/app/models/has_one_field.rb
555
- - test/dummy/app/views/layouts/application.html.erb
556
- - test/dummy/app/assets/stylesheets/application.css
580
+ - test/dummy/app/models/has_many_through_field.rb
581
+ - test/dummy/app/models/float_field.rb
582
+ - test/dummy/app/models/has_and_belongs_to_many_field.rb
557
583
  - test/dummy/app/assets/javascripts/application.js
584
+ - test/dummy/app/assets/stylesheets/application.css
558
585
  - test/dummy/app/assets/config/manifest.js
559
- - test/dummy/public/404.html
586
+ - test/dummy/app/controllers/application_controller.rb
587
+ - test/dummy/app/views/layouts/application.html.erb
560
588
  - test/dummy/public/favicon.ico
561
589
  - test/dummy/public/422.html
590
+ - test/dummy/public/404.html
562
591
  - test/dummy/public/500.html
563
- - test/dummy/README.rdoc
564
- - test/dummy/bin/setup
565
- - test/dummy/bin/rails
566
- - test/dummy/bin/bundle
567
- - test/dummy/bin/rake
568
- - test/dummy/config/environments/test.rb
569
- - test/dummy/config/environments/production.rb
570
- - test/dummy/config/environments/development.rb
571
- - test/dummy/config/boot.rb
572
- - test/dummy/config/database.yml
573
- - test/dummy/config/application.rb
574
- - test/dummy/config/environment.rb
575
- - test/dummy/config/initializers/cookies_serializer.rb
576
- - test/dummy/config/initializers/session_store.rb
577
- - test/dummy/config/initializers/assets.rb
578
- - test/dummy/config/initializers/inflections.rb
579
- - test/dummy/config/initializers/wrap_parameters.rb
580
- - test/dummy/config/initializers/mime_types.rb
581
- - test/dummy/config/initializers/backtrace_silencers.rb
582
- - test/dummy/config/initializers/filter_parameter_logging.rb
583
- - test/dummy/config/routes.rb
584
- - test/dummy/config/secrets.yml
585
- - test/dummy/config/locales/en.yml
592
+ - test/fixtures/serialize_field.yml
593
+ - test/fixtures/has_one_field.yml
586
594
  - test/fixtures/owner.yml
595
+ - test/fixtures/has_many_field.yml
596
+ - test/fixtures/has_many_through_field.yml
587
597
  - test/fixtures/tree.yml
588
598
  - test/fixtures/reference.yml
589
- - test/fixtures/serialize_field.yml
590
- - test/fixtures/has_many_through_field.yml
591
- - test/fixtures/has_one_field.yml
592
- - test/fixtures/string_field.yml
593
599
  - test/fixtures/belongs_to_field.yml
594
- - test/fixtures/has_many_field.yml
595
- - test/services/forest_liana/operator_date_interval_parser_test.rb
596
- - test/services/forest_liana/schema_adapter_test.rb
597
- - test/forest_liana_test.rb
598
- - test/routing/route_test.rb
599
- - test/test_helper.rb
600
- - spec/rails_helper.rb
601
- - spec/spec_helper.rb
600
+ - test/fixtures/string_field.yml
602
601
  - spec/helpers/forest_liana/query_helper_spec.rb
603
602
  - spec/helpers/forest_liana/schema_helper_spec.rb
604
- - spec/requests/authentications_spec.rb
605
- - spec/requests/resources_spec.rb
606
- - spec/requests/actions_controller_spec.rb
607
- - spec/requests/stats_spec.rb
603
+ - spec/services/forest_liana/permissions_checker_acl_disabled_spec.rb
604
+ - spec/services/forest_liana/has_many_getter_spec.rb
605
+ - spec/services/forest_liana/smart_action_field_validator_spec.rb
606
+ - spec/services/forest_liana/permissions_checker_live_queries_spec.rb
607
+ - spec/services/forest_liana/schema_adapter_spec.rb
608
+ - spec/services/forest_liana/scope_manager_spec.rb
609
+ - spec/services/forest_liana/permissions_formatter_spec.rb
610
+ - spec/services/forest_liana/filters_parser_spec.rb
611
+ - spec/services/forest_liana/apimap_sorter_spec.rb
612
+ - spec/services/forest_liana/pie_stat_getter_spec.rb
613
+ - spec/services/forest_liana/resources_getter_spec.rb
614
+ - spec/services/forest_liana/permissions_getter_spec.rb
615
+ - spec/services/forest_liana/line_stat_getter_spec.rb
616
+ - spec/services/forest_liana/value_stat_getter_spec.rb
617
+ - spec/services/forest_liana/resource_updater_spec.rb
618
+ - spec/services/forest_liana/permissions_checker_acl_enabled_spec.rb
619
+ - spec/services/forest_liana/ip_whitelist_checker_spec.rb
620
+ - spec/spec_helper.rb
621
+ - spec/lib/forest_liana/bootstrapper_spec.rb
622
+ - spec/lib/forest_liana/schema_file_updater_spec.rb
623
+ - spec/config/initializers/logger_spec.rb
624
+ - spec/rails_helper.rb
625
+ - spec/dummy/Rakefile
626
+ - spec/dummy/bin/setup
627
+ - spec/dummy/bin/bundle
628
+ - spec/dummy/bin/rake
629
+ - spec/dummy/bin/rails
608
630
  - spec/dummy/db/schema.rb
609
631
  - spec/dummy/db/migrate/20190716135241_add_type_to_user.rb
610
632
  - spec/dummy/db/migrate/20190226174951_create_tree.rb
611
- - spec/dummy/db/migrate/20190226173051_create_isle.rb
612
- - spec/dummy/db/migrate/20210526084712_create_products.rb
613
- - spec/dummy/db/migrate/20190716130830_add_age_to_tree.rb
614
633
  - spec/dummy/db/migrate/20210326110524_create_references.rb
634
+ - spec/dummy/db/migrate/20210526084712_create_products.rb
615
635
  - spec/dummy/db/migrate/20190226172951_create_user.rb
616
636
  - spec/dummy/db/migrate/20210511141752_create_owners.rb
637
+ - spec/dummy/db/migrate/20190716130830_add_age_to_tree.rb
617
638
  - spec/dummy/db/migrate/20210326140855_create_locations.rb
639
+ - spec/dummy/db/migrate/20190226173051_create_isle.rb
618
640
  - spec/dummy/config.ru
619
- - spec/dummy/Rakefile
620
- - spec/dummy/app/controllers/forest/islands_controller.rb
621
- - spec/dummy/app/controllers/application_controller.rb
622
- - spec/dummy/app/helpers/application_helper.rb
623
- - spec/dummy/app/models/product.rb
624
- - spec/dummy/app/models/reference.rb
625
- - spec/dummy/app/models/island.rb
626
- - spec/dummy/app/models/owner.rb
627
- - spec/dummy/app/models/tree.rb
628
- - spec/dummy/app/models/user.rb
629
- - spec/dummy/app/models/location.rb
630
- - spec/dummy/app/views/layouts/application.html.erb
631
- - spec/dummy/app/config/routes.rb
632
- - spec/dummy/app/assets/stylesheets/application.css
633
- - spec/dummy/app/assets/javascripts/application.js
634
- - spec/dummy/app/assets/config/manifest.js
635
641
  - spec/dummy/README.rdoc
636
- - spec/dummy/lib/forest_liana/collections/island.rb
637
642
  - spec/dummy/lib/forest_liana/collections/user.rb
643
+ - spec/dummy/lib/forest_liana/collections/island.rb
638
644
  - spec/dummy/lib/forest_liana/collections/location.rb
639
- - spec/dummy/bin/setup
640
- - spec/dummy/bin/rails
641
- - spec/dummy/bin/bundle
642
- - spec/dummy/bin/rake
643
- - spec/dummy/config/environments/test.rb
645
+ - spec/dummy/config/environment.rb
646
+ - spec/dummy/config/database.yml
644
647
  - spec/dummy/config/environments/production.rb
648
+ - spec/dummy/config/environments/test.rb
645
649
  - spec/dummy/config/environments/development.rb
646
- - spec/dummy/config/boot.rb
647
- - spec/dummy/config/database.yml
648
- - spec/dummy/config/application.rb
649
- - spec/dummy/config/environment.rb
650
+ - spec/dummy/config/routes.rb
651
+ - spec/dummy/config/secrets.yml
652
+ - spec/dummy/config/initializers/backtrace_silencers.rb
653
+ - spec/dummy/config/initializers/wrap_parameters.rb
654
+ - spec/dummy/config/initializers/mime_types.rb
650
655
  - spec/dummy/config/initializers/cookies_serializer.rb
651
- - spec/dummy/config/initializers/session_store.rb
652
- - spec/dummy/config/initializers/assets.rb
653
656
  - spec/dummy/config/initializers/forest_liana.rb
654
657
  - spec/dummy/config/initializers/inflections.rb
655
- - spec/dummy/config/initializers/wrap_parameters.rb
656
- - spec/dummy/config/initializers/mime_types.rb
657
- - spec/dummy/config/initializers/backtrace_silencers.rb
658
658
  - spec/dummy/config/initializers/filter_parameter_logging.rb
659
- - spec/dummy/config/routes.rb
660
- - spec/dummy/config/secrets.yml
661
- - spec/services/forest_liana/resource_updater_spec.rb
662
- - spec/services/forest_liana/permissions_checker_acl_enabled_spec.rb
663
- - spec/services/forest_liana/apimap_sorter_spec.rb
664
- - spec/services/forest_liana/resources_getter_spec.rb
665
- - spec/services/forest_liana/smart_action_field_validator_spec.rb
666
- - spec/services/forest_liana/permissions_getter_spec.rb
667
- - spec/services/forest_liana/permissions_formatter_spec.rb
668
- - spec/services/forest_liana/has_many_getter_spec.rb
669
- - spec/services/forest_liana/schema_adapter_spec.rb
670
- - spec/services/forest_liana/ip_whitelist_checker_spec.rb
671
- - spec/services/forest_liana/scope_manager_spec.rb
672
- - spec/services/forest_liana/pie_stat_getter_spec.rb
673
- - spec/services/forest_liana/filters_parser_spec.rb
674
- - spec/services/forest_liana/permissions_checker_live_queries_spec.rb
675
- - spec/services/forest_liana/value_stat_getter_spec.rb
676
- - spec/services/forest_liana/permissions_checker_acl_disabled_spec.rb
677
- - spec/services/forest_liana/line_stat_getter_spec.rb
678
- - spec/lib/forest_liana/schema_file_updater_spec.rb
679
- - spec/lib/forest_liana/bootstrapper_spec.rb
680
- - spec/config/initializers/logger_spec.rb
659
+ - spec/dummy/config/initializers/session_store.rb
660
+ - spec/dummy/config/initializers/assets.rb
661
+ - spec/dummy/config/application.rb
662
+ - spec/dummy/config/boot.rb
663
+ - spec/dummy/app/helpers/application_helper.rb
664
+ - spec/dummy/app/models/tree.rb
665
+ - spec/dummy/app/models/reference.rb
666
+ - spec/dummy/app/models/user.rb
667
+ - spec/dummy/app/models/island.rb
668
+ - spec/dummy/app/models/owner.rb
669
+ - spec/dummy/app/models/product.rb
670
+ - spec/dummy/app/models/location.rb
671
+ - spec/dummy/app/config/routes.rb
672
+ - spec/dummy/app/assets/javascripts/application.js
673
+ - spec/dummy/app/assets/stylesheets/application.css
674
+ - spec/dummy/app/assets/config/manifest.js
675
+ - spec/dummy/app/controllers/application_controller.rb
676
+ - spec/dummy/app/controllers/forest/islands_controller.rb
677
+ - spec/dummy/app/views/layouts/application.html.erb
678
+ - spec/dummy/tmp/cache/11D/A92/http%3A%2F%2Flocalhost%3A3000%2Fforest%2Fauthentication%2Fcallback-env_secret_test-client-data
679
+ - spec/requests/resources_spec.rb
680
+ - spec/requests/authentications_spec.rb
681
+ - spec/requests/actions_controller_spec.rb
682
+ - spec/requests/stats_spec.rb