authentasaurus 0.6.21 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/app/models/authentasaurus_emailer.rb +6 -6
  2. data/app/views/authentasaurus_emailer/invitation_mail.html.erb +2 -2
  3. data/app/views/authentasaurus_emailer/recovery_mail.html.erb +2 -2
  4. data/app/views/authentasaurus_emailer/validation_mail.html.erb +2 -2
  5. data/lib/action_controller/authorization.rb +1 -1
  6. data/lib/active_record/acts_as_authenticatable.rb +2 -2
  7. data/lib/active_record/authenticatable.rb +1 -1
  8. data/lib/active_resource/authenticatable.rb +4 -4
  9. data/lib/authentasaurus.rb +61 -17
  10. data/lib/authentasaurus/models/area.rb +17 -15
  11. data/lib/authentasaurus/models/group.rb +15 -13
  12. data/lib/authentasaurus/models/permission.rb +20 -18
  13. data/lib/authentasaurus/models/recovery.rb +34 -32
  14. data/lib/authentasaurus/models/session.rb +63 -56
  15. data/lib/authentasaurus/models/user_invitation.rb +27 -25
  16. data/lib/authentasaurus/models/validation.rb +26 -24
  17. data/lib/authentasaurus/railtie.rb +13 -0
  18. data/lib/authentasaurus/sessions_controller.rb +0 -1
  19. data/lib/generators/authentasaurus/install/USAGE +5 -0
  20. data/lib/generators/authentasaurus/install/install_generator.rb +11 -0
  21. data/{generators/authentasaurus → lib/generators/authentasaurus/install}/templates/authentasaurus_tasks.rake +2 -2
  22. data/{generators/authentasaurus → lib/generators/authentasaurus/install}/templates/defaults.yml +0 -0
  23. data/lib/generators/authentasaurus/install/templates/initializer.rb +3 -0
  24. data/{generators/authentasaurus_views → lib/generators/authentasaurus/views}/USAGE +1 -0
  25. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/areas/edit.html.erb +0 -0
  26. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/areas/index.html.erb +0 -0
  27. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/areas/new.html.erb +0 -0
  28. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/areas/show.html.erb +0 -0
  29. data/lib/generators/authentasaurus/views/templates/authentasaurus_emailer/invitation_mail.html.erb +4 -0
  30. data/lib/generators/authentasaurus/views/templates/authentasaurus_emailer/recovery_mail.html.erb +7 -0
  31. data/lib/generators/authentasaurus/views/templates/authentasaurus_emailer/validation_mail.html.erb +6 -0
  32. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/groups/edit.html.erb +0 -0
  33. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/groups/index.html.erb +0 -0
  34. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/groups/new.html.erb +0 -0
  35. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/groups/show.html.erb +0 -0
  36. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/permissions/edit.html.erb +0 -0
  37. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/permissions/index.html.erb +0 -0
  38. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/permissions/new.html.erb +0 -0
  39. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/permissions/show.html.erb +0 -0
  40. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/recoveries/edit.html.erb +0 -0
  41. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/recoveries/new.html.erb +0 -0
  42. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/registrations/new.html.erb +0 -0
  43. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/sessions/new.html.erb +0 -0
  44. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/sessions/no_access.html.erb +0 -0
  45. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/user_invitations/index.html.erb +0 -0
  46. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/user_invitations/new.html.erb +0 -0
  47. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/users/edit.html.erb +0 -0
  48. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/users/index.html.erb +0 -0
  49. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/users/new.html.erb +0 -0
  50. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/users/show.html.erb +0 -0
  51. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/validations/resend_validation_email.html.erb +0 -0
  52. data/{generators/authentasaurus_views/templates/views → lib/generators/authentasaurus/views/templates}/validations/validate.html.erb +0 -0
  53. data/lib/generators/authentasaurus/views/views_generator.rb +76 -0
  54. data/lib/helpers/migrations.rb +1 -1
  55. data/lib/helpers/routing.rb +18 -22
  56. metadata +67 -56
  57. data/generators/authentasaurus/USAGE +0 -2
  58. data/generators/authentasaurus/authentasaurus_generator.rb +0 -9
  59. data/generators/authentasaurus/templates/initializer.rb +0 -3
  60. data/generators/authentasaurus_views/authentasaurus_views_generator.rb +0 -91
  61. data/generators/authentasaurus_views/templates/views/authentasaurus_emailer/invitation_mail.html.erb +0 -4
  62. data/generators/authentasaurus_views/templates/views/authentasaurus_emailer/recovery_mail.html.erb +0 -7
  63. data/generators/authentasaurus_views/templates/views/authentasaurus_emailer/validation_mail.html.erb +0 -6
  64. data/rails/init.rb +0 -41
@@ -1,2 +0,0 @@
1
- Description:
2
- Generates a configurations file for Authentasaurus with defaults.
@@ -1,9 +0,0 @@
1
- class AuthentasaurusGenerator < Rails::Generator::Base
2
- def manifest
3
- record do |m|
4
- m.file "initializer.rb", File.join("config", "initializers", "authentasaurus.rb")
5
- m.file "defaults.yml", File.join("config", "authentasaurus.yml")
6
- m.file "authentasaurus_tasks.rake", File.join("lib","tasks","authentasaurus.rake")
7
- end
8
- end
9
- end
@@ -1,3 +0,0 @@
1
- # Loads the system configuration
2
- # Usage: AUTHENTASAURUS_CONFIGURATIONS[:section][:key]
3
- AUTHENTASAURUS = YAML.load(File.read(Rails.root.join("config", "authentasaurus.yml")))[RAILS_ENV]
@@ -1,91 +0,0 @@
1
- class AuthentasaurusViewsGenerator < Rails::Generator::NamedBase
2
- default_options :authorizable => false, :validatable => false, :invitable => false
3
-
4
- def manifest
5
- record do |m|
6
- # Controller, View , Model, test, and fixture directories.
7
- m.directory File.join('app/views', class_path)
8
- # Other directories
9
- m.directory File.join('app/views', class_path, "sessions")
10
- m.directory File.join('app/views', class_path, file_name)
11
- m.directory File.join('app/views', class_path, "authentasaurus_emailer")
12
- m.directory File.join('app/views', class_path, "recoveries")
13
-
14
- # Views
15
- ## user sessions
16
- m.file 'views/sessions/new.html.erb', File.join("app/views", class_path, "sessions", "new.html.erb")
17
- m.file 'views/sessions/no_access.html.erb', File.join("app/views", class_path, "sessions", "no_access.html.erb")
18
- ## users
19
- m.file 'views/users/edit.html.erb', File.join("app/views", class_path, file_name, "edit.html.erb")
20
- m.file 'views/users/index.html.erb', File.join("app/views", class_path, file_name, "index.html.erb")
21
- m.file 'views/users/new.html.erb', File.join("app/views", class_path, file_name, "new.html.erb")
22
- m.file 'views/users/show.html.erb', File.join("app/views", class_path, file_name, "show.html.erb")
23
- ## recoverable
24
- m.file 'views/recoveries/new.html.erb', File.join("app/views", class_path, "recoveries", "new.html.erb")
25
- m.file 'views/recoveries/edit.html.erb', File.join("app/views", class_path, "recoveries", "edit.html.erb")
26
- m.file 'views/authentasaurus_emailer/recovery_mail.html.erb', File.join("app/views", class_path, "authentasaurus_emailer", "recovery_mail.html.erb")
27
-
28
-
29
- if options[:authorizable]
30
- m.directory File.join('app/views', class_path, "groups")
31
- m.directory File.join('app/views', class_path, "areas")
32
- m.directory File.join('app/views', class_path, "permissions")
33
- ## groups
34
- m.file 'views/groups/show.html.erb', File.join('app/views', class_path, "groups", "show.html.erb")
35
- m.file 'views/groups/index.html.erb', File.join("app/views", class_path, "groups", "index.html.erb")
36
- m.file 'views/groups/edit.html.erb', File.join("app/views", class_path, "groups", "edit.html.erb")
37
- m.file 'views/groups/new.html.erb', File.join("app/views", class_path, "groups", "new.html.erb")
38
- ## areas
39
- m.file 'views/areas/edit.html.erb', File.join("app/views", class_path, "areas", "edit.html.erb")
40
- m.file 'views/areas/index.html.erb', File.join("app/views", class_path, "areas", "index.html.erb")
41
- m.file 'views/areas/new.html.erb', File.join("app/views", class_path, "areas", "new.html.erb")
42
- m.file 'views/areas/show.html.erb', File.join("app/views", class_path, "areas", "show.html.erb")
43
- ## permissions
44
- m.file 'views/permissions/edit.html.erb', File.join("app/views", class_path, "permissions", "edit.html.erb")
45
- m.file 'views/permissions/index.html.erb', File.join("app/views", class_path, "permissions", "index.html.erb")
46
- m.file 'views/permissions/new.html.erb', File.join("app/views", class_path, "permissions", "new.html.erb")
47
- m.file 'views/permissions/show.html.erb', File.join("app/views", class_path, "permissions", "show.html.erb")
48
- end
49
-
50
- # Validations
51
- if options[:validatable]
52
- m.directory File.join('app/views', class_path, "validations")
53
-
54
- # Views
55
- m.file 'views/validations/activate.html.erb', File.join("app/views", class_path, "validations", "activate.html.erb")
56
- m.file 'views/validations/resend_validation_email.html.erb', File.join("app/views", class_path, "validations", "resend_validation_email.html.erb")
57
- m.file 'views/authentasaurus_emailer/validation_mail.html.erb', File.join("app/views", class_path, "authentasaurus_emailer", "validation_mail.html.erb")
58
- end
59
-
60
- # User invitations
61
- if options[:invitable]
62
- m.directory File.join('app/views', class_path, "user_invitations")
63
- m.directory File.join('app/views', class_path, "registrations")
64
-
65
- #Views
66
- m.file 'views/user_invitations/index.html.erb', File.join('app/views', class_path, 'user_invitations', "index.html.erb")
67
- m.file 'views/user_invitations/new.html.erb', File.join('app/views', class_path, 'user_invitations', "new.html.erb")
68
-
69
- m.file 'views/registrations/new.html.erb', File.join('app/views', class_path, 'registrations', "new.html.erb")
70
-
71
- m.file 'views/authentasaurus_emailer/invitation_mail.html.erb', File.join("app/views", class_path, "authentasaurus_emailer", "invitation_mail.html.erb")
72
- end
73
- end
74
- end
75
-
76
- protected
77
- def banner
78
- "Usage: #{$0} #{spec.name} MainUserControllerName"
79
- end
80
-
81
- def add_options!(opt)
82
- opt.separator ''
83
- opt.separator 'Options:'
84
- opt.on("--validatable",
85
- "Add validation to authentasaurus") { |v| options[:validatable] = v }
86
- opt.on("--authorizable",
87
- "Add authorization to authentasaurus") { |v| options[:authorizable] = v }
88
- opt.on("--invitable",
89
- "Add invitations to authentasaurus") { |v| options[:invitable] = v }
90
- end
91
- end
@@ -1,4 +0,0 @@
1
- <p>You've been invited to create an account at <%= AUTHENTASAURUS[:mail][:host] %> follow this <%= link_to "link", new_registrations_url(:host => AUTHENTASAURUS[:mail][:host], :token => @token) %> to respond to the invitation.</p>
2
-
3
- <p>Best Regards,</p>
4
- <p><%= AUTHENTASAURUS[:mail][:host] %> Team</p>
@@ -1,7 +0,0 @@
1
- <p>Dear <%= @name %>,</p>
2
-
3
- <p>A request has been made to recover your account's password.</p>
4
- <p>Please visit this <%= link_to "link", recover_password_url(:host => AUTHENTASAURUS[:mail][:host], :token => @token) %> and follow the instructions.</p>
5
-
6
- <p>Best Regards,</p>
7
- <p><%= AUTHENTASAURUS[:mail][:host] %> Team</p>
@@ -1,6 +0,0 @@
1
- <p>Dear <%= @name %>,</p>
2
-
3
- <p>Please validate your account at <%= AUTHENTASAURUS[:mail][:host] %> by visiting this <%= link_to "link", activate_url(:host => AUTHENTASAURUS[:mail][:host] , :code => @vcode) %>.</p>
4
-
5
- <p>Best Regards,</p>
6
- <p><%= AUTHENTASAURUS[:mail][:host] %> Team</p>
data/rails/init.rb DELETED
@@ -1,41 +0,0 @@
1
- require 'action_controller/authorization'
2
- require 'action_view/authorization'
3
- require 'active_record/authenticatable'
4
- require 'active_resource/authenticatable'
5
- require 'helpers/routing'
6
- require 'helpers/migrations'
7
-
8
- if defined? ActionController
9
- class ActionController::Base
10
- include ActionController::Authorization
11
- end
12
-
13
- class ActionView::Base
14
- include ActionView::Authorization
15
- end
16
-
17
- class ActionController::Routing::RouteSet::Mapper
18
- include Helpers::Routing
19
- end
20
- end
21
-
22
- if defined? ActiveRecord
23
- class ActiveRecord::Base
24
- include ActiveRecord::Authenticatable
25
- end
26
-
27
- class ActiveRecord::ConnectionAdapters::AbstractAdapter
28
- include Helpers::Migrations::Tables
29
- end
30
-
31
- class ActiveRecord::ConnectionAdapters::TableDefinition
32
- include Helpers::Migrations::Columns
33
- end
34
- end
35
-
36
- if defined? ActiveResource
37
- class ActiveResource::Base
38
- class_inheritable_accessor :sync, :sync_to
39
- include ActiveResource::Authenticatable
40
- end
41
- end