propel_authentication 0.3.0 → 0.3.1.1

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.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -0
  3. data/lib/generators/propel_authentication/install_generator.rb +198 -241
  4. data/lib/generators/propel_authentication/templates/auth/passwords_controller.rb.tt +1 -4
  5. data/lib/generators/propel_authentication/templates/auth/signup_controller.rb.tt +3 -6
  6. data/lib/generators/propel_authentication/templates/auth/tokens_controller.rb.tt +2 -5
  7. data/lib/generators/propel_authentication/templates/core/configuration_methods.rb +38 -1
  8. data/lib/generators/propel_authentication/templates/db/migrate/create_agencies.rb +2 -0
  9. data/lib/generators/propel_authentication/templates/db/migrate/create_agents.rb +6 -1
  10. data/lib/generators/propel_authentication/templates/db/migrate/create_users.rb +2 -0
  11. data/lib/generators/propel_authentication/templates/db/propel_seeds.rb.tt +145 -0
  12. data/lib/generators/propel_authentication/templates/doc/signup_flow.md +9 -4
  13. data/lib/generators/propel_authentication/templates/fixtures/agencies.yml.erb +23 -0
  14. data/lib/generators/propel_authentication/templates/fixtures/agents.yml.erb +71 -0
  15. data/lib/generators/propel_authentication/templates/fixtures/invitations.yml.erb +9 -0
  16. data/lib/generators/propel_authentication/templates/fixtures/organizations.yml.erb +21 -0
  17. data/lib/generators/propel_authentication/templates/fixtures/users.yml.erb +77 -0
  18. data/lib/generators/propel_authentication/templates/models/agency.rb.tt +4 -0
  19. data/lib/generators/propel_authentication/templates/models/agent.rb.tt +9 -0
  20. data/lib/generators/propel_authentication/templates/models/invitation.rb.tt +3 -1
  21. data/lib/generators/propel_authentication/templates/models/organization.rb.tt +3 -0
  22. data/lib/generators/propel_authentication/templates/propel_authentication.rb.tt +33 -6
  23. data/lib/generators/propel_authentication/templates/test/controllers/auth/lockable_integration_test.rb.tt +1 -1
  24. data/lib/generators/propel_authentication/templates/test/controllers/auth/password_reset_integration_test.rb.tt +1 -1
  25. data/lib/generators/propel_authentication/templates/test/controllers/auth/tokens_controller_test.rb.tt +4 -4
  26. data/lib/propel_authentication.rb +1 -1
  27. metadata +8 -3
  28. data/lib/generators/propel_authentication/templates/db/seeds.rb +0 -75
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.0
4
+ version: 0.3.1.1
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-10 00:00:00.000000000 Z
11
+ date: 2025-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -110,8 +110,13 @@ files:
110
110
  - lib/generators/propel_authentication/templates/db/migrate/create_invitations.rb
111
111
  - lib/generators/propel_authentication/templates/db/migrate/create_organizations.rb
112
112
  - lib/generators/propel_authentication/templates/db/migrate/create_users.rb
113
- - lib/generators/propel_authentication/templates/db/seeds.rb
113
+ - lib/generators/propel_authentication/templates/db/propel_seeds.rb.tt
114
114
  - lib/generators/propel_authentication/templates/doc/signup_flow.md
115
+ - lib/generators/propel_authentication/templates/fixtures/agencies.yml.erb
116
+ - lib/generators/propel_authentication/templates/fixtures/agents.yml.erb
117
+ - lib/generators/propel_authentication/templates/fixtures/invitations.yml.erb
118
+ - lib/generators/propel_authentication/templates/fixtures/organizations.yml.erb
119
+ - lib/generators/propel_authentication/templates/fixtures/users.yml.erb
115
120
  - lib/generators/propel_authentication/templates/models/agency.rb.tt
116
121
  - lib/generators/propel_authentication/templates/models/agent.rb.tt
117
122
  - lib/generators/propel_authentication/templates/models/invitation.rb.tt
@@ -1,75 +0,0 @@
1
- # This file should ensure the existence of records required to run the application in every environment (production,
2
- # development, test). The code here should be idempotent so that it can be executed at any point in every environment.
3
- # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
4
- #
5
- # Example:
6
- #
7
- # ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
8
- # MovieGenre.find_or_create_by!(name: genre_name)
9
- # end
10
-
11
- # Create comprehensive tenancy structure for authentication testing
12
- puts "🏢 Creating test organization structure..."
13
-
14
- organization = Organization.find_or_create_by!(name: 'Test Organization') do |org|
15
- org.website = 'https://test.example.com'
16
- org.time_zone = 'UTC'
17
- end
18
-
19
- # Create agencies for proper tenancy structure
20
- main_agency = Agency.find_or_create_by!(name: 'Main Department', organization: organization) do |agency|
21
- agency.phone_number = '+1-555-0101'
22
- agency.address = '123 Main Street'
23
- end
24
-
25
- support_agency = Agency.find_or_create_by!(name: 'Support Department', organization: organization) do |agency|
26
- agency.phone_number = '+1-555-0102'
27
- agency.address = '123 Support Street'
28
- end
29
-
30
- # Create test users with proper confirmations
31
- user = User.find_or_create_by!(email_address: 'test@example.com') do |u|
32
- u.username = 'testuser'
33
- u.email_address = 'test@example.com'
34
- u.password = 'password123'
35
- u.password_confirmation = 'password123'
36
- u.organization = organization
37
- u.first_name = 'Test'
38
- u.last_name = 'User'
39
- u.confirmed_at = 1.week.ago # Confirmed user for easier testing
40
- end
41
-
42
- admin_user = User.find_or_create_by!(email_address: 'admin@example.com') do |u|
43
- u.username = 'adminuser'
44
- u.email_address = 'admin@example.com'
45
- u.password = 'password123'
46
- u.password_confirmation = 'password123'
47
- u.organization = organization
48
- u.first_name = 'Admin'
49
- u.last_name = 'User'
50
- u.confirmed_at = 1.week.ago # Confirmed admin for easier testing
51
- end
52
-
53
- # Create agent associations for agency access (CRITICAL for tenancy validation)
54
- Agent.find_or_create_by!(user: user, agency: main_agency) do |agent|
55
- agent.role = 'member'
56
- end
57
-
58
- Agent.find_or_create_by!(user: admin_user, agency: main_agency) do |agent|
59
- agent.role = 'manager'
60
- end
61
-
62
- Agent.find_or_create_by!(user: admin_user, agency: support_agency) do |agent|
63
- agent.role = 'admin'
64
- end
65
-
66
- puts "✅ Created test organization: #{organization.name}"
67
- puts "✅ Created agencies: #{Agency.where(organization: organization).pluck(:name).join(', ')}"
68
- puts "✅ Created test user: #{user.email_address} (password: password123)"
69
- puts "✅ Created admin user: #{admin_user.email_address} (password: password123)"
70
- puts "✅ Created agent associations for proper tenancy access"
71
- puts ""
72
- puts "🎯 Test user agency access: #{user.agency_ids}"
73
- puts "🎯 Admin user agency access: #{admin_user.agency_ids}"
74
- puts ""
75
- puts "🚀 You can now test login with POST /api/v1/login"