plutonium 0.15.3 → 0.15.4

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: efeff0c37b9324cda81466502842699a582497d5e1317c91f164b25874a32449
4
- data.tar.gz: 6a96d30f12ebfd707bf82fb32d1603edcf800fe1182764e68da44ec48f39067c
3
+ metadata.gz: 69be8d5055a10969befe7de4c78dea74e60f1da9ed5c3754d7a0b70ad74e6974
4
+ data.tar.gz: 98c4fb79a936ab08f6164c13bcd268f9ecaa4de42fc7ce1be5b47d68fe33a2d7
5
5
  SHA512:
6
- metadata.gz: ec41dc9bd147b822dcc2073b716226d335b2b66d3f8804fce6d51b5be0ff6b23f0beeed1c9bd57c9f630f5590b2d27f2563de463e2b7ea2fbf48d6889c7c21a2
7
- data.tar.gz: 1cc88ca30635864a7a3d522811046382229b2ad1078b48bc31c500094b92e01b18dc4be5f86ba4d2c52f4f548bcdf55d65b34e54e7306852b86e9586cb954b0c
6
+ metadata.gz: faa4d002ac3d47973decd9531931131407b64de718acf1914ac3f8fa2ca1d584a562940897a4dff20591c94804b029ea001a88af66e0acde61e1dbe58e68a995
7
+ data.tar.gz: b91536d180e95b9d80e95fca3064e788bfca9410da7bd4e003c6fc7a618f7a3e9d7298ac38f7a8453f55e40776b5d6faae6560a9110eb04b8a1b265a74492ddb
@@ -7,7 +7,7 @@ module PlutoniumUi
7
7
  def base_attributes
8
8
  # base attributes go here
9
9
  {
10
- classname: "sidebar-menu space-y-2",
10
+ classname: "sidebar-menu space-y-2 pb-6 mb-6",
11
11
  controller: "sidebar-menu"
12
12
  }
13
13
  end
@@ -28,6 +28,11 @@ module Plutonium
28
28
  def entity_scope_for_authorize
29
29
  scoped_to_entity? ? current_scoped_entity : nil
30
30
  end
31
+
32
+ def verify_authorized
33
+ # we don't use action policy's inbuilt checks, so ensure they are neutered,
34
+ # also ensures pundit checks are disabled.
35
+ end
31
36
  end
32
37
  end
33
38
  end
@@ -81,16 +81,16 @@ module Plutonium
81
81
  # @return [ActiveRecord::Base, nil] the current scoped entity or nil if not found
82
82
  # @raise [NotImplementedError] if the scoping strategy is unknown
83
83
  def fetch_current_scoped_entity
84
- scoped_entity = case scoped_entity_strategy
84
+ case scoped_entity_strategy
85
85
  when :path
86
- fetch_entity_from_path
86
+ scoped_entity = fetch_entity_from_path
87
+ authorize! scoped_entity, to: :read?
88
+ scoped_entity
87
89
  when Symbol
88
90
  send(scoped_entity_strategy)
89
91
  else
90
92
  raise NotImplementedError, "Unknown scoped entity strategy: #{scoped_entity_strategy.inspect}"
91
93
  end
92
- authorize! scoped_entity, to: :read?
93
- scoped_entity
94
94
  end
95
95
 
96
96
  # Fetches the scoped entity from the path parameters.
@@ -172,8 +172,13 @@ module Plutonium
172
172
  # @param [Hash] input_params The input parameters
173
173
  def override_entity_scoping_params(input_params)
174
174
  if scoped_to_entity?
175
- input_params[scoped_entity_param_key] = current_scoped_entity
176
- input_params[:"#{scoped_entity_param_key}_id"] = current_scoped_entity.id
175
+ if input_params.key?(scoped_entity_param_key) || resource_class.method_defined?(:"#{scoped_entity_param_key}=")
176
+ input_params[scoped_entity_param_key] = current_scoped_entity
177
+ end
178
+
179
+ if input_params.key?(:"#{scoped_entity_param_key}_id") || resource_class.method_defined?(:"#{scoped_entity_param_key}_id=")
180
+ input_params[:"#{scoped_entity_param_key}_id"] = current_scoped_entity.id
181
+ end
177
182
  end
178
183
  end
179
184
 
@@ -181,8 +186,13 @@ module Plutonium
181
186
  # @param [Hash] input_params The input parameters
182
187
  def override_parent_params(input_params)
183
188
  if current_parent.present?
184
- input_params[parent_input_param] = current_parent
185
- input_params[:"#{parent_input_param}_id"] = current_parent.id
189
+ if input_params.key?(parent_input_param) || resource_class.method_defined?(:"#{parent_input_param}=")
190
+ input_params[parent_input_param] = current_parent
191
+ end
192
+
193
+ if input_params.key?(:"#{parent_input_param}_id") || resource_class.method_defined?(:"#{parent_input_param}_id=")
194
+ input_params[:"#{parent_input_param}_id"] = current_parent.id
195
+ end
186
196
  end
187
197
  end
188
198
 
@@ -77,7 +77,7 @@ module Plutonium
77
77
  #
78
78
  # @raise [ActionMissingCurrentAuthorizedScope] if current_authorized_scope hasn't been called
79
79
  def verify_current_authorized_scope
80
- return if current_authorized_scope_count
80
+ return if verify_current_authorized_scope_skipped
81
81
  return if current_authorized_scope_count > 0
82
82
 
83
83
  raise ActionMissingCurrentAuthorizedScope.new(controller_path, action_name)
@@ -1,5 +1,5 @@
1
1
  module Plutonium
2
- VERSION = "0.15.3"
2
+ VERSION = "0.15.4"
3
3
  NEXT_MAJOR_VERSION = VERSION.split(".").tap { |v|
4
4
  v[1] = v[1].to_i + 1
5
5
  v[2] = 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plutonium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.3
4
+ version: 0.15.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Froelich