rhino_project_core 0.30.0.alpha.14 → 0.30.0.alpha.15

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: 94494b306f6725a3889a08333c9b7d6bd6ae9c58e49d225234f359781130fc8c
4
- data.tar.gz: 52c65110920f52ec46271dfc16ffeb738c80f344db9860f865dfcd09814d178b
3
+ metadata.gz: 7c3c0715e3664edd24fa42e711c47db0955a19422a2e984566494d8602810a5f
4
+ data.tar.gz: f1ba9388ec978e26361b13355172b641e049e4f5331f1d5e87a5c61746dafe34
5
5
  SHA512:
6
- metadata.gz: 345595919d14b989b121a1d71b9a724efbb1046b1f3d964c98f65ebf6fc49d6e2215444dada9769dadcea40498ab1fdca6cf9d0d9b26ddca3b52a1e30428141e
7
- data.tar.gz: 24e722ec2baf21dee4d34098d1c04282c17cfd26eba0c794d3ca242f28d2fb22502e521da6bd6870b9faeba6e3e296e5473eb53cdd0840a66b45f26083539409
6
+ metadata.gz: 30977d8aeb0c1489349db37ffff6130a5ab65fb3ddcb45a70f16611543b354de48a46d2d1e6e7e04ac1af32313a8ee0ab1db03afee87f435b0c11d09a3356a14
7
+ data.tar.gz: 32e57851051dd1f5729f79c45852552b9dd10e54807abbd4dbb35ea208d4a1f31dc303e41d6855d95b5485a0de751276ee1fd7fc6d0737dd27335c9f9047803b
@@ -5,12 +5,10 @@ module Rhino
5
5
  module_function
6
6
 
7
7
  def strategies_metadata
8
- params = { resource_class: "User" }
9
-
10
8
  strategies.each_with_object([]) do |strategy, array|
11
9
  array << {
12
10
  name: strategy,
13
- path: "#{::OmniAuth.config.path_prefix}/#{strategy}?#{params.to_param}"
11
+ path: "#{::OmniAuth.config.path_prefix}/#{strategy}"
14
12
  }
15
13
  end
16
14
  end
@@ -23,8 +21,6 @@ module Rhino
23
21
  match[1].downcase.to_sym
24
22
  end.uniq
25
23
 
26
- strategies += [:developer] if Rails.env.development? && !Rake.try(:application)
27
-
28
24
  strategies
29
25
  end
30
26
 
@@ -25,6 +25,10 @@ module Rhino
25
25
  name || email
26
26
  end
27
27
 
28
+ def token_validation_response
29
+ to_caching_json
30
+ end
31
+
28
32
  def self.roles_for_auth(auth_owner, record = nil)
29
33
  return {} unless auth_owner
30
34
 
@@ -5,7 +5,7 @@ module DeviseTokenAuth::ConfirmationsController::Extensions
5
5
  def show
6
6
  super
7
7
  rescue StandardError
8
- redirect_to ENV["FRONT_END_URL"]
8
+ redirect_to ENV["ROOT_URL"]
9
9
  end
10
10
  end
11
11
 
@@ -4,6 +4,6 @@ class DeviseTokenAuth::PasswordsController
4
4
  # If there is an error preparing to edit the password, redirect to frontend
5
5
  # This would normally be an expired password token
6
6
  def render_edit_error
7
- redirect_to "#{ENV['FRONT_END_URL']}/auth/reset-password/expired"
7
+ redirect_to "#{ENV['ROOT_URL']}/auth/reset-password/expired"
8
8
  end
9
9
  end
@@ -13,6 +13,14 @@ module DeviseTokenAuth::RegistrationsController::Extensions
13
13
  create_organization(resource) if Rhino.resources.include?("Organization")
14
14
  end
15
15
  end
16
+
17
+ # Get all the information just like the token_validation_response and sign_in
18
+ def render_create_success
19
+ render json: {
20
+ success: true,
21
+ data: resource_data(resource_json: @resource.token_validation_response)
22
+ }
23
+ end
16
24
  end
17
25
 
18
26
  class DeviseTokenAuth::RegistrationsController
@@ -2,7 +2,6 @@ PORT=<%= server_port %>
2
2
 
3
3
  # Server
4
4
  ROOT_URL=http://localhost:$PORT
5
- FRONT_END_URL=http://localhost:$PORT
6
5
 
7
6
  DB_NAME=<%= db_name %>
8
7
  DB_HOST=<%= db_host %>
@@ -10,9 +9,6 @@ DB_PORT=<%= db_port %>
10
9
  DB_USERNAME=<%= db_user %>
11
10
  DB_PASSWORD=<%= db_password %>
12
11
 
13
- # Client
14
- VITE_API_ROOT_PATH=$ROOT_URL
15
-
16
12
  # Production server:
17
13
  SENDGRID_API_KEY=<api-key>
18
14
 
@@ -66,6 +66,6 @@ DeviseTokenAuth.setup do |config|
66
66
  # send email, set it to true. (This is a setting for compatibility)
67
67
  # config.send_confirmation_email = true
68
68
 
69
- config.default_confirm_success_url = "#{ENV['FRONT_END_URL']}/auth/signin"
70
- config.default_password_reset_url = "#{ENV['FRONT_END_URL']}/auth/reset-password"
69
+ config.default_confirm_success_url = "#{ENV['ROOT_URL']}/auth/signin"
70
+ config.default_password_reset_url = "#{ENV['ROOT_URL']}/auth/reset-password"
71
71
  end
@@ -89,7 +89,12 @@ module Rhino
89
89
  # An array of references
90
90
  if desc[:type] == :array && (desc[:items].key?(:$ref) || desc[:items].key?(:anyOf))
91
91
  # FIXME: Hack for has_many_attached
92
- next params << { prop => [] } if desc.dig(:items, :anyOf)[0]&.dig(:$ref) == "#/components/schemas/active_storage_attachment"
92
+ if desc.dig(:items, :anyOf)[0]&.dig(:$ref) == "#/components/schemas/active_storage_attachment"
93
+ params << { prop => [] }
94
+ params << { prop => ["signed_id"] }
95
+
96
+ next
97
+ end
93
98
 
94
99
  # We only accept if the active record accepts it
95
100
  next unless nested_attributes_options.key?(prop_sym) || desc.dig(:items, :anyOf)[0]&.dig(:$ref)
@@ -138,7 +143,8 @@ module Rhino
138
143
 
139
144
  { prop => assoc_params.flatten.uniq }
140
145
  else
141
- { prop => klasses.map(&:identifier_property).uniq }
146
+ # For ActiveStorage::Attachment we want to accept the signed_id
147
+ { prop => klasses.map { it == ActiveStorage::Attachment ? "signed_id" : it.identifier_property }.uniq }
142
148
  end
143
149
  end
144
150
 
@@ -162,12 +168,25 @@ module Rhino
162
168
  # FIXME
163
169
  # Hack to rewrite for attachment/attachments and guard against object resubmission
164
170
  if param_key.end_with?("_attachment")
165
- hash[param_key.remove("_attachment")] = param_value if param_value.is_a?(String) || param_value.nil?
171
+ # If its a string, its the signed_id
172
+ hash[param_key.remove("_attachment")] = if param_value.is_a?(String) || param_value.nil?
173
+ param_value
174
+
175
+ # Otherwise if its a hash, and we want the signed_id from it
176
+ elsif param_value.is_a?(ActionController::Parameters)
177
+ param_value["signed_id"]
178
+ end
166
179
 
167
180
  next
168
181
  end
169
182
  if param_key.end_with?("_attachments")
170
- hash[param_key.remove("_attachments")] = param_value if param_value.is_a?(Array) || param_value.nil?
183
+ hash[param_key.remove("_attachments")] = if param_value.nil?
184
+ param_value
185
+
186
+ # if an element is a string, its the signed_id, if its a hash, we want the signed_id from it
187
+ elsif param_value.is_a?(Array)
188
+ param_value.map { it.is_a?(ActionController::Parameters) ? it["signed_id"] : it }
189
+ end
171
190
 
172
191
  next
173
192
  end
data/lib/rhino/version.rb CHANGED
@@ -10,7 +10,7 @@ module Rhino
10
10
  MAJOR = 0
11
11
  MINOR = 30
12
12
  TINY = 0
13
- PRE = "alpha.14"
13
+ PRE = "alpha.15"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhino_project_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.0.alpha.14
4
+ version: 0.30.0.alpha.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Rosevear
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-01 00:00:00.000000000 Z
10
+ date: 2025-03-01 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails