propel_authentication 0.3.1.6 โ†’ 0.3.3

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: 6cd741c44d75fbf65d7f7db0eaf8f1fc2d777791da65a17104118ae8264791bd
4
- data.tar.gz: f381d9454b167d222d2b029a9568ee1c55e79bf52c760d044c5a506e4a7ea52e
3
+ metadata.gz: 49609b9aadde056ceb7d0aaa9f5e6442b1665efcff9236cf581c93a05199d617
4
+ data.tar.gz: 23ad3f6706cffe5f0841322cea1dbba44fff43ca8a5feddf6d1dbb32bc57c411
5
5
  SHA512:
6
- metadata.gz: 6983150a0198d1d3dd5e371f7f61a14b66cbfc8408e5937aa997e2c2b12ecb4bbd8786354515fd326cc6f6af19eb772225843d479a62702217f9b6a0bb15f71d
7
- data.tar.gz: 67759000cd49bc86d34770197a40893d7120ce5209b2936687267d841f7589fa13f19e379e1e7e9a08c96cac9012fed3a82448e53d7ca843384d14b824e25601
6
+ metadata.gz: cdcb9d2852913c823a8a3e6642044572fe1a931bd72872b9d186d1595dc36b280946535600a1bda07b0a0a9cf2cf76e388a564c5eb209fcfa529b9ee2bbbfdb7
7
+ data.tar.gz: f2178a8e4baece710a38a41042062cb91511ea86567ce796745dc51ec6d4320e9e94c0412d949cb835b0bfb91fb9cac936553747142436ceda265acb0fa7d915
data/CHANGELOG.md CHANGED
@@ -13,6 +13,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
  - Session management and device tracking
14
14
  - Advanced password policies
15
15
 
16
+ ## [0.3.3] - 2025-01-XX
17
+
18
+ ### ๐Ÿ”ง Version Synchronization
19
+ - **Version Consistency**: Updated version to maintain consistency with PropelApi 0.3.3 comprehensive filtering system
20
+ - No functional changes in this release
21
+ - Synchronized release with PropelApi's new dynamic filtering capabilities
22
+ - Better coordination with PropelApi's enhanced test suite and documentation
23
+
24
+ ### ๐Ÿงช Enhanced Test Integration
25
+ - **Filtering System Compatibility**: Authentication system now fully compatible with PropelApi's new filtering features
26
+ - JWT token validation works seamlessly with filtered API endpoints
27
+ - Multi-tenancy scoping integrates properly with dynamic filtering
28
+ - Organization context properly maintained across all filtered queries
29
+
30
+ ## [0.3.2] - 2025-09-15
31
+
32
+ ### ๐Ÿ”ง Version Synchronization
33
+ - **Version Consistency**: Updated version to maintain consistency with PropelApi 0.3.2 critical generator improvements
34
+ - No functional changes in this release
35
+ - Synchronized release with PropelApi's enhanced generator destroy/rollback functionality
36
+ - Better coordination with PropelApi's improved generator infrastructure and error handling
37
+
16
38
  ## [0.3.1.6] - 2025-09-13
17
39
 
18
40
  ### ๐Ÿ”ง Version Synchronization
@@ -182,8 +182,53 @@ module PropelAuthentication
182
182
  return
183
183
  end
184
184
 
185
- # Use dedicated routes template for clean separation of concerns
186
- route template_file_for_routes
185
+ add_auth_routes_simple
186
+ end
187
+
188
+ def add_auth_routes_simple
189
+ routes_content = File.read("config/routes.rb")
190
+
191
+ # Check if auth routes already exist - be specific
192
+ if routes_content.include?("post 'login', to: 'tokens#create'")
193
+ say "Authentication routes already exist, skipping", :yellow
194
+ return
195
+ end
196
+
197
+ auth_routes = [
198
+ "post 'signup', to: 'signup#create', as: :signup",
199
+ "post 'login', to: 'tokens#create', as: :login",
200
+ "get 'me', to: 'tokens#show', as: :me",
201
+ "delete 'logout', to: 'tokens#destroy', as: :logout",
202
+ "post 'unlock', to: 'tokens#unlock', as: :unlock",
203
+ "post 'reset', to: 'passwords#create', as: :reset",
204
+ "get 'reset', to: 'passwords#show', as: :verify_reset",
205
+ "patch 'reset', to: 'passwords#update', as: :update_reset"
206
+ ]
207
+
208
+ # Try to insert into existing namespace, otherwise create new
209
+ if @auth_namespace.present? && @auth_version.present?
210
+ # Look for api/v1 pattern
211
+ pattern = /namespace\s+:#{@auth_namespace}\s+do\s*\n\s*namespace\s+:#{@auth_version}\s+do\s*\n/
212
+ if routes_content.match?(pattern)
213
+ # Insert into existing namespace with proper indentation
214
+ gsub_file "config/routes.rb", pattern do |match|
215
+ routes_to_add = auth_routes.map { |r| " #{r}" }.join("\n") + "\n"
216
+ match + routes_to_add
217
+ end
218
+ say "Added authentication routes to existing #{@auth_namespace}/#{@auth_version} namespace", :green
219
+ else
220
+ # Create new namespace
221
+ route_block = "namespace :#{@auth_namespace} do\n namespace :#{@auth_version} do\n"
222
+ auth_routes.each { |r| route_block += " #{r}\n" }
223
+ route_block += " end\nend"
224
+ route route_block
225
+ say "Created new #{@auth_namespace}/#{@auth_version} namespace with authentication routes", :green
226
+ end
227
+ else
228
+ # Fallback - just add routes
229
+ route auth_routes.join("\n")
230
+ say "Added authentication routes at root level", :green
231
+ end
187
232
  end
188
233
 
189
234
  def copy_authentication_migrations_and_fixtures
@@ -297,11 +342,6 @@ module PropelAuthentication
297
342
  end
298
343
  end
299
344
 
300
- # Render authentication routes template to string
301
- def template_file_for_routes
302
- source_path = find_in_source_paths("routes/auth_routes.rb.tt")
303
- ERB.new(File.read(source_path), trim_mode: '-').result(binding)
304
- end
305
345
 
306
346
 
307
347
  def migration_exists?(migration_name)
@@ -12,8 +12,17 @@ class Agency < ApplicationRecord
12
12
 
13
13
  # Facets
14
14
  json_facet :short,
15
- fields: [:id, :name]
15
+ fields:
16
+ [
17
+ :id, :name, :phone_number, :time_zone, :address, :type<% if PropelAuthentication.configuration.organization_required? -%><% end -%>
18
+ ]
16
19
  json_facet :details,
17
- fields: [:id, :name, :organization_id, :created_at, :updated_at]
20
+ fields:
21
+ [
22
+ :id, :name<% if PropelAuthentication.configuration.organization_required? -%>, :organization_id<% end -%>,
23
+ :phone_number, :address, :time_zone,
24
+ :created_at, :updated_at,
25
+ :metadata, :settings<% if PropelAuthentication.configuration.organization_required? -%>, :type<% end -%>
26
+ ]<% if PropelAuthentication.configuration.organization_required? -%>, include: [:organization]<% end -%>
18
27
  <% end -%>
19
28
  end
@@ -17,8 +17,23 @@ class Agent < ApplicationRecord
17
17
 
18
18
  # Facets
19
19
  json_facet :short,
20
- fields: [:id, :title]
20
+ fields:
21
+ [
22
+ :id, :title, :role, :user_id<% if PropelAuthentication.configuration.organization_required? || PropelAuthentication.configuration.agency_required? -%>, :type<% end -%>
23
+ ]
21
24
  json_facet :details,
22
- fields: [:id, :title, :role, :organization_id, :created_at, :updated_at]
25
+ fields:
26
+ [
27
+ :id, :title, :role<% if PropelAuthentication.configuration.organization_required? -%>, :organization_id<% end -%><% if PropelAuthentication.configuration.agency_required? -%>, :agency_id<% end -%>, :user_id,
28
+ :created_at, :updated_at<% if PropelAuthentication.configuration.organization_required? || PropelAuthentication.configuration.agency_required? -%>, :type<% end -%>
29
+ ], include: [<% include_associations = [] -%>
30
+ <% if PropelAuthentication.configuration.organization_required? -%>
31
+ <% include_associations << ':organization' -%>
32
+ <% end -%>
33
+ <% if PropelAuthentication.configuration.agency_required? -%>
34
+ <% include_associations << ':agency' -%>
35
+ <% end -%>
36
+ <% include_associations << ':user' -%>
37
+ <%= include_associations.join(', ') %>]
23
38
  <% end -%>
24
39
  end
@@ -1,3 +1,3 @@
1
1
  module PropelAuthentication
2
- VERSION = "0.3.1.6"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propel_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1.6
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Propel Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-09-13 00:00:00.000000000 Z
11
+ date: 2025-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -123,7 +123,6 @@ files:
123
123
  - lib/generators/propel_authentication/templates/models/organization.rb.tt
124
124
  - lib/generators/propel_authentication/templates/models/user.rb.tt
125
125
  - lib/generators/propel_authentication/templates/propel_authentication.rb.tt
126
- - lib/generators/propel_authentication/templates/routes/auth_routes.rb.tt
127
126
  - lib/generators/propel_authentication/templates/services/auth_notification_service.rb
128
127
  - lib/generators/propel_authentication/templates/test/concerns/confirmable_test.rb.tt
129
128
  - lib/generators/propel_authentication/templates/test/concerns/lockable_test.rb.tt
@@ -1,55 +0,0 @@
1
- # JWT Authentication routes for <%= auth_route_prefix %>
2
- <%- if @auth_namespace.present? || @auth_version.present? || @auth_scope.present? -%>
3
- <%- namespace_parts = [] -%>
4
- <%- namespace_parts << @auth_namespace if @auth_namespace.present? -%>
5
- <%- namespace_parts << @auth_version if @auth_version.present? -%>
6
- <%- namespace_parts.each_with_index do |part, index| -%>
7
- <%= " " * index %>namespace :<%= part %> do
8
- <%- end -%>
9
- <%- if @auth_scope.present? -%>
10
- <%= " " * namespace_parts.length %>namespace :<%= @auth_scope %> do
11
- <%= " " * (namespace_parts.length + 1) %>post 'signup', to: 'signup#create', as: :signup
12
- <%= " " * (namespace_parts.length + 1) %>post 'login', to: 'tokens#create', as: :login
13
- <%= " " * (namespace_parts.length + 1) %>get 'me', to: 'tokens#show', as: :me
14
- <%= " " * (namespace_parts.length + 1) %>delete 'logout', to: 'tokens#destroy', as: :logout
15
- <%= " " * (namespace_parts.length + 1) %>post 'unlock', to: 'tokens#unlock', as: :unlock
16
- <%= " " * (namespace_parts.length + 1) %>post 'reset', to: 'passwords#create', as: :reset
17
- <%= " " * (namespace_parts.length + 1) %>get 'reset', to: 'passwords#show', as: :verify_reset
18
- <%= " " * (namespace_parts.length + 1) %>patch 'reset', to: 'passwords#update', as: :update_reset
19
- <%= " " * namespace_parts.length %>end
20
- <%- else -%>
21
- <%= " " * namespace_parts.length %>post 'signup', to: 'signup#create', as: :signup
22
- <%= " " * namespace_parts.length %>post 'login', to: 'tokens#create', as: :login
23
- <%= " " * namespace_parts.length %>get 'me', to: 'tokens#show', as: :me
24
- <%= " " * namespace_parts.length %>delete 'logout', to: 'tokens#destroy', as: :logout
25
- <%= " " * namespace_parts.length %>post 'unlock', to: 'tokens#unlock', as: :unlock
26
- <%= " " * namespace_parts.length %>post 'reset', to: 'passwords#create', as: :reset
27
- <%= " " * namespace_parts.length %>get 'reset', to: 'passwords#show', as: :verify_reset
28
- <%= " " * namespace_parts.length %>patch 'reset', to: 'passwords#update', as: :update_reset
29
- <%- end -%>
30
- <%- namespace_parts.length.times do |index| -%>
31
- <%= " " * (namespace_parts.length - 1 - index) %>end
32
- <%- end -%>
33
- <%- else -%>
34
- <%- if @auth_scope.present? -%>
35
- namespace :<%= @auth_scope %> do
36
- post 'signup', to: 'signup#create', as: :signup
37
- post 'login', to: 'tokens#create', as: :login
38
- get 'me', to: 'tokens#show', as: :me
39
- delete 'logout', to: 'tokens#destroy', as: :logout
40
- post 'unlock', to: 'tokens#unlock', as: :unlock
41
- post 'reset', to: 'passwords#create', as: :reset
42
- get 'reset', to: 'passwords#show', as: :verify_reset
43
- patch 'reset', to: 'passwords#update', as: :update_reset
44
- end
45
- <%- else -%>
46
- post 'signup', to: 'signup#create', as: :signup
47
- post 'login', to: 'tokens#create', as: :login
48
- get 'me', to: 'tokens#show', as: :me
49
- delete 'logout', to: 'tokens#destroy', as: :logout
50
- post 'unlock', to: 'tokens#unlock', as: :unlock
51
- post 'reset', to: 'passwords#create', as: :reset
52
- get 'reset', to: 'passwords#show', as: :verify_reset
53
- patch 'reset', to: 'passwords#update', as: :update_reset
54
- <%- end -%>
55
- <%- end -%>