glib-web 0.11.11 → 0.11.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/glib/auth/policy.rb +15 -9
  3. data/app/controllers/concerns/glib/json/new_dynamic_text.rb +0 -0
  4. data/app/controllers/concerns/glib/json/ui.rb +7 -1
  5. data/app/helpers/glib/app_feature_support_helper.rb +0 -0
  6. data/app/helpers/glib/dynamic_texts_helper.rb +0 -0
  7. data/app/helpers/glib/forms_helper.rb +0 -0
  8. data/app/helpers/glib/json_ui/action_builder/http.rb +0 -0
  9. data/app/helpers/glib/json_ui/action_builder/sheets.rb +0 -0
  10. data/app/helpers/glib/json_ui/action_builder/snackbars.rb +0 -0
  11. data/app/helpers/glib/json_ui/analytics_helper.rb +0 -0
  12. data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
  13. data/app/helpers/glib/json_ui/table_builders.rb +0 -0
  14. data/app/helpers/glib/json_ui/view_builder/fields.rb +2 -0
  15. data/app/helpers/glib/urls_helper.rb +0 -0
  16. data/app/models/glib/active_storage/attachment.rb +0 -0
  17. data/app/models/glib/active_storage/blob.rb +0 -0
  18. data/app/models/glib/dynamic_text_record.rb +0 -0
  19. data/app/models/glib/text.rb +0 -0
  20. data/app/policies/glib/application_policy.rb +2 -25
  21. data/app/validators/email_typo_validator.rb +0 -0
  22. data/app/validators/email_validator.rb +0 -0
  23. data/app/validators/url_validator.rb +0 -0
  24. data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +0 -0
  25. data/app/views/json_ui/garage/actions/_dialogs_show.json.jbuilder +0 -0
  26. data/app/views/json_ui/garage/actions/_http.json.jbuilder +0 -0
  27. data/app/views/json_ui/garage/actions/_panels.json.jbuilder +0 -0
  28. data/app/views/json_ui/garage/actions/_reload.json.jbuilder +0 -0
  29. data/app/views/json_ui/garage/actions/_sheets.json.jbuilder +0 -0
  30. data/app/views/json_ui/garage/actions/_snackbars.json.jbuilder +0 -0
  31. data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +0 -0
  32. data/app/views/json_ui/garage/forms/basic_post.json.jbuilder +0 -0
  33. data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +0 -0
  34. data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +0 -0
  35. data/app/views/json_ui/garage/forms/floating_submit.json.jbuilder +0 -0
  36. data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
  37. data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
  38. data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
  39. data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +0 -0
  40. data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +0 -0
  41. data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
  42. data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
  43. data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +0 -0
  44. data/app/views/json_ui/garage/lists/autoload_as_needed.json.jbuilder +0 -0
  45. data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +0 -0
  46. data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
  47. data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +0 -0
  48. data/app/views/json_ui/garage/pages/flat_centered.json.jbuilder +0 -0
  49. data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
  50. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
  51. data/app/views/json_ui/garage/pages/index.json.jbuilder +0 -0
  52. data/app/views/json_ui/garage/pages/layout.json.jbuilder +0 -0
  53. data/app/views/json_ui/garage/pages/lifecycle_hooks.json.jbuilder +0 -0
  54. data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
  55. data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +0 -0
  56. data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
  57. data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
  58. data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
  59. data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
  60. data/app/views/json_ui/garage/panels/responsive.json.jbuilder +0 -0
  61. data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
  62. data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
  63. data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
  64. data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
  65. data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
  66. data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +0 -0
  67. data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
  68. data/app/views/json_ui/garage/tables/index.json.jbuilder +0 -0
  69. data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +0 -0
  70. data/app/views/json_ui/garage/views/links.json.jbuilder +0 -0
  71. data/app/views/json_ui/garage/views/map_cluster_data.json.jbuilder +0 -0
  72. data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
  73. data/app/views/json_ui/garage/views/multimedia.json.jbuilder +0 -0
  74. data/config/routes.rb +0 -0
  75. data/lib/generators/glib/install_generator.rb +0 -0
  76. data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
  77. data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
  78. data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
  79. data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
  80. data/lib/generators/templates/database.yml +0 -0
  81. data/lib/generators/templates/dynamic_text.rb +0 -0
  82. data/lib/glib/crypt/utils.rb +0 -0
  83. data/lib/glib/crypt.rb +0 -0
  84. data/lib/glib/dynamic_text/config.rb +0 -0
  85. data/lib/glib/dynamic_text.rb +0 -0
  86. data/lib/glib/engine.rb +0 -0
  87. data/lib/glib/json_crawler/action_crawler.rb +0 -0
  88. data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
  89. data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +0 -0
  90. data/lib/glib/json_crawler/action_crawlers/menu.rb +0 -0
  91. data/lib/glib/json_crawler/action_crawlers/nav_initiate.rb +0 -0
  92. data/lib/glib/json_crawler/action_crawlers/run_multiple.rb +0 -0
  93. data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
  94. data/lib/glib/json_crawler/coverage.rb +0 -0
  95. data/lib/glib/json_crawler.rb +0 -0
  96. data/lib/glib/mailer_tester.rb +0 -0
  97. data/lib/glib/value.rb +0 -0
  98. data/lib/glib/version.rb +0 -0
  99. data/lib/glib-web.rb +0 -0
  100. data/lib/tasks/db.rake +0 -0
  101. metadata +2 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85abe76e3d1977c064f2e86fdbb94762e1876847a81fca85846c7081f6ccb863
4
- data.tar.gz: '0192085bf3a998491f3090afc395a953d31d4c66d8199e6754fd9f0e1c71c430'
3
+ metadata.gz: 65e03cb325fe0731639826551be244fb295bb235ab6827e4060a1d5a4456dc40
4
+ data.tar.gz: 4497dcb065e19ef1582364b808ea8e7e2c326bb627dbaa2b42f2e338034364c1
5
5
  SHA512:
6
- metadata.gz: 030c770a4d216aa32c5ca2f01d662112de29646adbe92777bdf4eed1e3b027896c4bbf9fe201780190c9d964f1c0a500cb7f3aaded8d337565b7ad249dc96d00
7
- data.tar.gz: 191d5d6e515722fdf0bb53f84c4c689dba91c5fb4112c850d9b6540ab5b3e376b8c7eda433a80e2b577efd74c838459cbe900cca27590557473b4a952942c09c
6
+ metadata.gz: ca511e3f5e906017cfbcc40ac66549d1643bb1adad4b9214dbc005d0843bab733379e155d1c74674c89efa2f286097e90e063ec2b413bafe39e238cf3fc43a1c
7
+ data.tar.gz: 42396920cf99da0d9581537694c4aacc1c1e14137ec42beac92201bb47ebcb80c0b4c7dc653be62be421eea3982d4bac8b3e7768ad2569a67a32d5755aa599f3
@@ -5,7 +5,7 @@ module Glib::Auth
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- include Pundit
8
+ include Pundit::Authorization
9
9
  include Overrides
10
10
  extend ClassMethods
11
11
 
@@ -20,11 +20,14 @@ module Glib::Auth
20
20
  module Overrides
21
21
 
22
22
  public # Override
23
- def policy(record, policy_name = nil, attributes = {})
23
+ def policy(record, policy_name = nil, context = nil)
24
24
  policy_name ||= record
25
25
 
26
26
  @__pundit_policies ||= {}
27
- return @__pundit_policies[policy_name] if @__pundit_policies[policy_name]
27
+ if @__pundit_policies[policy_name]
28
+ @__pundit_policies[policy_name].context = context
29
+ return @__pundit_policies[policy_name]
30
+ end
28
31
 
29
32
  if policy_name.is_a?(Symbol) && policy_name.to_s.ends_with?('_admin')
30
33
  policy_class = CommonAdminPolicy
@@ -34,7 +37,10 @@ module Glib::Auth
34
37
 
35
38
  raise "Policy not found for #{policy_name.is_a?(Symbol) || policy_name.is_a?(Class) ? policy_name : policy_name.class}" unless policy_class
36
39
 
37
- @__pundit_policies[policy_name] = policy_class.new(current_user, record, policy_name, self, request, params, attributes: attributes)
40
+ policy_instance = policy_class.new(current_user, record, policy_name, self, request, params)
41
+ policy_instance.context = context
42
+
43
+ @__pundit_policies[policy_name] = policy_instance
38
44
  end
39
45
 
40
46
  # Expose protected method
@@ -51,13 +57,13 @@ module Glib::Auth
51
57
  end
52
58
 
53
59
  public
54
- def can?(action, record, attributes = {})
55
- policy(record, nil, attributes).send("#{action}?")
60
+ def can?(action, record, context = nil)
61
+ policy(record, nil, context).send("#{action}?")
56
62
  end
57
63
 
58
64
  public
59
- def cannot?(action, record)
60
- !policy(record).send("#{action}?")
65
+ def cannot?(action, record, context = nil)
66
+ !policy(record, nil, context).send("#{action}?")
61
67
  end
62
68
 
63
69
  # Inspired from https://github.com/ryanb/cancan/wiki/Non-RESTful-Controllers
@@ -84,7 +90,7 @@ module Glib::Auth
84
90
  resource_instance = instance_variable_get("@#{resource_name}") || policy_name
85
91
 
86
92
  query = "#{action_name}?"
87
- policy_instance = policy(resource_instance, policy_name, options.except(:class))
93
+ policy_instance = policy(resource_instance, policy_name, options.fetch(:context, nil))
88
94
  raise_access_denied(resource_instance, policy_instance) unless policy_instance.public_send(query)
89
95
  end
90
96
 
@@ -83,6 +83,12 @@ module Glib::Json::Ui
83
83
  def __json_ui_vue(hash, options)
84
84
  renderer_path = options[:renderer_path]
85
85
  @__json_ui_orig_page = response.body
86
- response.body = render_to_string(template: renderer_path, layout: 'json_ui/renderer', content_type: 'text/html', locals: { page: hash, options: options })
86
+ response.body = render_to_string(
87
+ template: renderer_path,
88
+ layout: 'json_ui/renderer',
89
+ content_type: 'text/html',
90
+ formats: [:html],
91
+ locals: { page: hash, options: options }
92
+ )
87
93
  end
88
94
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -219,6 +219,8 @@ class Glib::JsonUi::ViewBuilder
219
219
  action :onClick
220
220
  string :offIcon
221
221
  string :onIcon
222
+
223
+ views :childViews
222
224
  end
223
225
 
224
226
  class File < Text
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -2,11 +2,11 @@
2
2
  # it's better to perform an explicit check (e.g. as a validation in the model or using a before_action).
3
3
  module Glib
4
4
  class ApplicationPolicy
5
+ attr_accessor :context
5
6
  attr_reader :user, :record, :policy_name, :controller, :request, :params
6
- class_attribute :should_exist_attributes, instance_writer: false, default: []
7
7
 
8
8
  private
9
- def initialize(user, record, policy_name, controller, request, params, attributes: {})
9
+ def initialize(user, record, policy_name, controller, request, params)
10
10
  @user = user
11
11
  @record = record
12
12
  @controller = controller
@@ -15,31 +15,11 @@ module Glib
15
15
  # See Presenter::Model::inside_mock_controller()
16
16
  @params = params
17
17
  @policy_name = policy_name
18
-
19
- if attributes.present? && controller.action_name != 'index'
20
- self.class.module_eval { attr_accessor(*attributes.keys) }
21
- attributes.each do |key, value|
22
- send("#{key}=", value)
23
- end
24
- end
25
-
26
- if controller.user_signed_in?
27
- should_exist_attributes.each do |attribute|
28
- if try(attribute).blank? && !['index'].include?(controller.action_name)
29
- raise "Attribute #{attribute} is blank, policy will not working properly"
30
- end
31
- end
32
- end
33
18
  end
34
19
 
35
20
  class << self
36
21
  attr_reader :catch_all
37
22
 
38
- def inherited(base)
39
- base.should_exist_attributes = should_exist_attributes.dup
40
- super
41
- end
42
-
43
23
  # This is to define the authorization logic for an action (or a group of actions). It's different from controller's
44
24
  # authorize().
45
25
  private # Used by child
@@ -58,9 +38,6 @@ module Glib
58
38
  end
59
39
  end
60
40
 
61
- def should_exist(*attributes)
62
- should_exist_attributes.push(*attributes)
63
- end
64
41
  end
65
42
 
66
43
  private
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/config/routes.rb CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
data/lib/glib/crypt.rb CHANGED
File without changes
File without changes
File without changes
data/lib/glib/engine.rb CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/lib/glib/value.rb CHANGED
File without changes
data/lib/glib/version.rb CHANGED
File without changes
data/lib/glib-web.rb CHANGED
File without changes
data/lib/tasks/db.rake CHANGED
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.11
4
+ version: 0.11.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -297,8 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
297
297
  - !ruby/object:Gem::Version
298
298
  version: '0'
299
299
  requirements: []
300
- rubyforge_project:
301
- rubygems_version: 2.7.6
300
+ rubygems_version: 3.1.4
302
301
  signing_key:
303
302
  specification_version: 4
304
303
  summary: ''