authentasaurus 0.7.3 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/TODO +3 -0
- data/app/controllers/areas_controller.rb +1 -1
- data/app/controllers/groups_controller.rb +1 -1
- data/app/controllers/permissions_controller.rb +1 -1
- data/app/controllers/recoveries_controller.rb +1 -1
- data/app/controllers/registrations_controller.rb +1 -1
- data/app/controllers/sessions_controller.rb +1 -1
- data/app/controllers/user_invitations_controller.rb +1 -1
- data/app/controllers/users_controller.rb +1 -1
- data/app/controllers/validations_controller.rb +1 -1
- data/app/models/area.rb +1 -1
- data/app/models/group.rb +1 -1
- data/app/models/permission.rb +1 -1
- data/app/models/recovery.rb +1 -1
- data/app/models/session.rb +1 -1
- data/app/models/user_invitation.rb +1 -1
- data/app/models/validation.rb +1 -1
- data/lib/authentasaurus.rb +22 -36
- data/lib/authentasaurus/ac/acts_as_overrider.rb +47 -0
- data/lib/authentasaurus/ac/controllers/areas_controller.rb +80 -0
- data/lib/authentasaurus/ac/controllers/groups_controller.rb +81 -0
- data/lib/authentasaurus/ac/controllers/permissions_controller.rb +81 -0
- data/lib/authentasaurus/ac/controllers/recoveries_controller.rb +72 -0
- data/lib/authentasaurus/ac/controllers/registrations_controller.rb +45 -0
- data/lib/authentasaurus/ac/controllers/sessions_controller.rb +58 -0
- data/lib/authentasaurus/ac/controllers/user_invitations_controller.rb +50 -0
- data/lib/authentasaurus/ac/controllers/users_controller.rb +80 -0
- data/lib/authentasaurus/ac/controllers/validations_controller.rb +53 -0
- data/lib/authentasaurus/ac/routing.rb +90 -0
- data/lib/authentasaurus/ar/acts_as_authenticatable.rb +113 -0
- data/lib/authentasaurus/ar/acts_as_authenticatable_validatable.rb +38 -0
- data/lib/authentasaurus/ar/acts_as_overrider.rb +51 -0
- data/lib/authentasaurus/ar/authenticatable.rb +66 -0
- data/lib/authentasaurus/ar/migrations.rb +173 -0
- data/lib/authentasaurus/{models → ar/models}/recovery.rb +3 -3
- data/lib/authentasaurus/{models → ar/models}/session.rb +1 -1
- data/lib/authentasaurus/{models → ar/models}/user_invitation.rb +1 -1
- data/lib/authentasaurus/{models → ar/models}/validation.rb +1 -1
- data/lib/authentasaurus/arel/acts_as_authenticatable.rb +72 -0
- data/lib/authentasaurus/arel/authenticatable.rb +25 -0
- data/lib/authentasaurus/authorization.rb +341 -0
- data/lib/authentasaurus/railtie.rb +4 -4
- data/lib/generators/authentasaurus/install/templates/initializer.rb +1 -1
- data/rdoc/apple-touch-icon.png +0 -0
- data/rdoc/classes/Authentasaurus.html +65 -0
- data/rdoc/classes/Authentasaurus/Ac.html +72 -0
- data/rdoc/classes/Authentasaurus/Ac/ActsAsOverrider.html +104 -0
- data/rdoc/classes/Authentasaurus/Ac/ActsAsOverrider/ClassMethods.html +397 -0
- data/rdoc/classes/Authentasaurus/Ac/Routing.html +61 -0
- data/rdoc/classes/Authentasaurus/Ac/Routing/InstanceMethods.html +390 -0
- data/rdoc/classes/Authentasaurus/Ar.html +77 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatable.html +107 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatable/ClassMethods.html +168 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatable/InstanceMethods.html +357 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatableValidatable.html +109 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatableValidatable/ClassMethods.html +113 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsAuthenticatableValidatable/InstanceMethods.html +54 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsOverrider.html +104 -0
- data/rdoc/classes/Authentasaurus/Ar/ActsAsOverrider/ClassMethods.html +320 -0
- data/rdoc/classes/Authentasaurus/Ar/Authenticatable.html +104 -0
- data/rdoc/classes/Authentasaurus/Ar/Authenticatable/ClassMethods.html +182 -0
- data/rdoc/classes/Authentasaurus/Ar/Migrations.html +63 -0
- data/rdoc/classes/Authentasaurus/Ar/Migrations/Columns.html +68 -0
- data/rdoc/classes/Authentasaurus/Ar/Migrations/Columns/InstanceMethods.html +106 -0
- data/rdoc/classes/Authentasaurus/Ar/Migrations/Tables.html +68 -0
- data/rdoc/classes/Authentasaurus/Ar/Migrations/Tables/InstanceMethods.html +703 -0
- data/rdoc/classes/Authentasaurus/Arel.html +65 -0
- data/rdoc/classes/Authentasaurus/Arel/ActsAsAuthenticatable.html +107 -0
- data/rdoc/classes/Authentasaurus/Arel/ActsAsAuthenticatable/ClassMethods.html +139 -0
- data/rdoc/classes/Authentasaurus/Arel/ActsAsAuthenticatable/InstanceMethods.html +113 -0
- data/rdoc/classes/Authentasaurus/Arel/Authenticatable.html +105 -0
- data/rdoc/classes/Authentasaurus/Arel/Authenticatable/ClassMethods.html +119 -0
- data/rdoc/classes/Authentasaurus/Authorization.html +230 -0
- data/rdoc/classes/Authentasaurus/Authorization/ActionController.html +63 -0
- data/rdoc/classes/Authentasaurus/Authorization/ActionController/ClassMethods.html +263 -0
- data/rdoc/classes/Authentasaurus/Authorization/ActionController/InstanceMethods.html +54 -0
- data/rdoc/classes/Authentasaurus/Authorization/ActionView.html +54 -0
- data/rdoc/classes/Authentasaurus/Authorization/CommonInstanceMethods.html +240 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/css/main.css +278 -0
- data/rdoc/css/panel.css +383 -0
- data/rdoc/css/reset.css +53 -0
- data/rdoc/favicon.ico +0 -0
- data/rdoc/files/README_rdoc.html +366 -0
- data/rdoc/files/TODO.html +64 -0
- data/rdoc/files/lib/authentasaurus/ac/acts_as_overrider_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/ac/routing_rb.html +60 -0
- data/rdoc/files/lib/authentasaurus/ar/acts_as_authenticatable_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/ar/acts_as_authenticatable_validatable_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/ar/acts_as_overrider_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/ar/authenticatable_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/ar/migrations_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/arel/acts_as_authenticatable_rb.html +52 -0
- data/rdoc/files/lib/authentasaurus/arel/authenticatable_rb.html +72 -0
- data/rdoc/files/lib/authentasaurus/authorization_rb.html +208 -0
- data/rdoc/i/arrows.png +0 -0
- data/rdoc/i/results_bg.png +0 -0
- data/rdoc/i/tree_bg.png +0 -0
- data/rdoc/index.html +15 -0
- data/rdoc/js/jquery-1.3.2.min.js +19 -0
- data/rdoc/js/jquery-effect.js +593 -0
- data/rdoc/js/main.js +22 -0
- data/rdoc/js/searchdoc.js +628 -0
- data/rdoc/panel/index.html +71 -0
- data/rdoc/panel/search_index.js +1 -0
- data/rdoc/panel/tree.js +1 -0
- metadata +92 -44
- data/lib/action_controller/authorization.rb +0 -215
- data/lib/action_view/authorization.rb +0 -52
- data/lib/active_record/acts_as_authenticatable.rb +0 -111
- data/lib/active_record/acts_as_authenticatable_validatable.rb +0 -36
- data/lib/active_record/authenticatable.rb +0 -64
- data/lib/active_resource/acts_as_authenticatable.rb +0 -70
- data/lib/active_resource/authenticatable.rb +0 -24
- data/lib/authentasaurus/areas_controller.rb +0 -78
- data/lib/authentasaurus/groups_controller.rb +0 -79
- data/lib/authentasaurus/models/area.rb +0 -21
- data/lib/authentasaurus/models/group.rb +0 -19
- data/lib/authentasaurus/models/permission.rb +0 -24
- data/lib/authentasaurus/permissions_controller.rb +0 -79
- data/lib/authentasaurus/recoveries_controller.rb +0 -70
- data/lib/authentasaurus/registrations_controller.rb +0 -43
- data/lib/authentasaurus/sessions_controller.rb +0 -56
- data/lib/authentasaurus/user_invitations_controller.rb +0 -48
- data/lib/authentasaurus/users_controller.rb +0 -78
- data/lib/authentasaurus/validations_controller.rb +0 -51
- data/lib/helpers/migrations.rb +0 -171
- data/lib/helpers/routing.rb +0 -87
@@ -1,51 +0,0 @@
|
|
1
|
-
module Authentasaurus::ValidationsController
|
2
|
-
def self.included(base) # :nodoc:
|
3
|
-
base.send :extend, ClassMethods
|
4
|
-
base.send :include, InstanceMethods
|
5
|
-
end
|
6
|
-
|
7
|
-
module ClassMethods
|
8
|
-
end
|
9
|
-
|
10
|
-
module InstanceMethods
|
11
|
-
def validate
|
12
|
-
respond_to do |format|
|
13
|
-
format.html
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def activate
|
18
|
-
respond_to do |format|
|
19
|
-
validation = Validation.find_by_validation_code(params[:vcode])
|
20
|
-
if validation
|
21
|
-
validation.user.activate
|
22
|
-
validation.destroy
|
23
|
-
format.html { redirect_to login_url, :notice => I18n.t(:validation_successful, :scope => [:authentasaurus, :messages, :validations])}
|
24
|
-
else
|
25
|
-
flash.now[:alert] = I18n.t(:validation_failed, :scope => [:authentasaurus, :messages, :validations])
|
26
|
-
format.html { render :validate }
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def resend_validation_email
|
32
|
-
respond_to do |format|
|
33
|
-
format.html
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def do_resend_validation_email
|
38
|
-
validation = Validation.find_by_email params[:email]
|
39
|
-
|
40
|
-
respond_to do |format|
|
41
|
-
unless validation.nil?
|
42
|
-
validation.send_validation
|
43
|
-
format.html {redirect_to login_url, :notice => I18n.t(:validation_email_sent, :scope => [:authentasaurus, :messages, :validations])}
|
44
|
-
else
|
45
|
-
flash.now[:alert] = I18n.t(:validation_email_invalid, :scope => [:authentasaurus, :messages, :validations], :email => params[:email])
|
46
|
-
format.html { render :resend_validation_email }
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/lib/helpers/migrations.rb
DELETED
@@ -1,171 +0,0 @@
|
|
1
|
-
module Migrations
|
2
|
-
# Extends ActiveRecord::ConnectionAdapters::SchemaStatements
|
3
|
-
module Tables
|
4
|
-
def self.included(base) # :nodoc:
|
5
|
-
base.send :include, InstanceMethods
|
6
|
-
end
|
7
|
-
|
8
|
-
module InstanceMethods
|
9
|
-
# creates all tables
|
10
|
-
def authentasaurus_tables
|
11
|
-
authentasaurus_user :authorizable
|
12
|
-
authentasaurus_group
|
13
|
-
authentasaurus_area
|
14
|
-
authentasaurus_permission
|
15
|
-
authentasaurus_validation
|
16
|
-
authentasaurus_user_invitation
|
17
|
-
authentasaurus_recovery
|
18
|
-
end
|
19
|
-
|
20
|
-
# creates users table
|
21
|
-
def authentasaurus_user(*opts)
|
22
|
-
create_table :users do |t|
|
23
|
-
t.string :username, :null => false
|
24
|
-
t.string :hashed_password, :null => false
|
25
|
-
t.string :password_seed, :null => false
|
26
|
-
t.string :name, :null => false
|
27
|
-
t.string :email, :null => false
|
28
|
-
t.boolean :active, :null => false, :default => false
|
29
|
-
t.string :remember_me_token
|
30
|
-
|
31
|
-
if opts.include?(:authorizable) || opts.include?("authorizable")
|
32
|
-
t.integer :group_id, :null => false
|
33
|
-
end
|
34
|
-
|
35
|
-
t.timestamps
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# creates groups table
|
40
|
-
def authentasaurus_group
|
41
|
-
create_table :groups do |t|
|
42
|
-
t.string :name, :null => false
|
43
|
-
|
44
|
-
t.timestamps
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# creates areas table
|
49
|
-
def authentasaurus_area
|
50
|
-
create_table :areas do |t|
|
51
|
-
t.string :name, :null => false
|
52
|
-
|
53
|
-
t.timestamps
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# creates permissions table
|
58
|
-
def authentasaurus_permission
|
59
|
-
create_table :permissions do |t|
|
60
|
-
t.integer :group_id, :null => false
|
61
|
-
t.integer :area_id, :null => false
|
62
|
-
t.boolean :read, :null => false, :default => false
|
63
|
-
t.boolean :write, :null => false, :default => false
|
64
|
-
|
65
|
-
t.timestamps
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
# creates validations table
|
70
|
-
def authentasaurus_validation
|
71
|
-
create_table :validations do |t|
|
72
|
-
t.integer :user_id, :null => false
|
73
|
-
t.string :user_type, :null => false
|
74
|
-
t.string :email, :null => false
|
75
|
-
t.string :validation_code, :null => false
|
76
|
-
|
77
|
-
t.timestamps
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
# creates user_invitations table
|
82
|
-
def authentasaurus_user_invitation
|
83
|
-
create_table :user_invitations do |t|
|
84
|
-
t.string :token, :null => false, :unique => true
|
85
|
-
t.string :email
|
86
|
-
|
87
|
-
t.timestamps
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
# creates recoveries table
|
92
|
-
def authentasaurus_recovery
|
93
|
-
create_table :recoveries do |t|
|
94
|
-
t.integer :user_id, :null => false
|
95
|
-
t.string :email, :null => false
|
96
|
-
t.string :token, :null => false, :unique => true
|
97
|
-
|
98
|
-
t.timestamps
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
# drops all tables
|
103
|
-
def authentasaurus_drop_tables
|
104
|
-
authentasaurus_drop_user
|
105
|
-
authentasaurus_drop_group
|
106
|
-
authentasaurus_drop_area
|
107
|
-
authentasaurus_drop_permission
|
108
|
-
authentasaurus_drop_validation
|
109
|
-
authentasaurus_drop_user_invitation
|
110
|
-
authentasaurus_drop_recovery
|
111
|
-
end
|
112
|
-
|
113
|
-
# drops users table
|
114
|
-
def authentasaurus_drop_user
|
115
|
-
drop_table :users
|
116
|
-
end
|
117
|
-
|
118
|
-
# drops groups table
|
119
|
-
def authentasaurus_drop_group
|
120
|
-
drop_table :groups
|
121
|
-
end
|
122
|
-
|
123
|
-
# drops areas table
|
124
|
-
def authentasaurus_drop_area
|
125
|
-
drop_table :areas
|
126
|
-
end
|
127
|
-
|
128
|
-
# drops permissions table
|
129
|
-
def authentasaurus_drop_permission
|
130
|
-
drop_table :permissions
|
131
|
-
end
|
132
|
-
|
133
|
-
# drops validations table
|
134
|
-
def authentasaurus_drop_validation
|
135
|
-
drop_table :validations
|
136
|
-
end
|
137
|
-
|
138
|
-
# drops user_invitations table
|
139
|
-
def authentasaurus_drop_user_invitation
|
140
|
-
drop_table :user_invitations
|
141
|
-
end
|
142
|
-
|
143
|
-
# drops recoveries table
|
144
|
-
def authentasaurus_drop_recovery
|
145
|
-
drop_table :recoveries
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
# Extends ActiveRecord::ConnectionAdapters::TableDefinition
|
151
|
-
module Columns
|
152
|
-
def self.included(base) # :nodoc:
|
153
|
-
base.send :include, InstanceMethods
|
154
|
-
end
|
155
|
-
|
156
|
-
module InstanceMethods
|
157
|
-
def user(*opts)
|
158
|
-
string :username, :null => false
|
159
|
-
string :hashed_password, :null => false
|
160
|
-
string :password_seed, :null => false
|
161
|
-
string :name, :null => false
|
162
|
-
string :email, :null => false
|
163
|
-
string :remember_me_token
|
164
|
-
boolean :active, :null => false, :default => false
|
165
|
-
if opts.include?(:authorizable)
|
166
|
-
integer :group_id, :null => false
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
data/lib/helpers/routing.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
## Authentasaurus routes helper
|
2
|
-
module Routing
|
3
|
-
def self.included(base) # :nodoc:
|
4
|
-
base.send :include, InstanceMethods
|
5
|
-
end
|
6
|
-
|
7
|
-
module InstanceMethods
|
8
|
-
# TODO: add documentation here
|
9
|
-
def authentasaurus_routes(*opts)
|
10
|
-
options = opts.extract_options!
|
11
|
-
|
12
|
-
# Authenticatable
|
13
|
-
authentasaurus_sessions options.dup
|
14
|
-
authentasaurus_users options.dup
|
15
|
-
# Recoverable
|
16
|
-
authentasaurus_recoverable
|
17
|
-
|
18
|
-
# Authorizable
|
19
|
-
if opts.include?(:authorization)
|
20
|
-
authentasaurus_authorizable options.dup
|
21
|
-
end
|
22
|
-
|
23
|
-
# Validatable
|
24
|
-
if opts.include?(:validation)
|
25
|
-
authentasaurus_validatable
|
26
|
-
end
|
27
|
-
|
28
|
-
# Invitable
|
29
|
-
if opts.include?(:invitation)
|
30
|
-
authentasaurus_invitable options.dup
|
31
|
-
authentasaurus_invitable_public
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# TODO: add documentation here
|
36
|
-
def authentasaurus_sessions(*opts)
|
37
|
-
options = opts.extract_options!
|
38
|
-
|
39
|
-
resources :sessions, options.dup.merge({:except => [:index, :show, :edit, :update], :path_names => {:new => 'sign-in'}, :collection => {:no_access => :get}})
|
40
|
-
end
|
41
|
-
|
42
|
-
# TODO: add documentation here
|
43
|
-
def authentasaurus_users(*opts)
|
44
|
-
options = opts.extract_options!
|
45
|
-
|
46
|
-
resources :users, options.dup
|
47
|
-
end
|
48
|
-
|
49
|
-
# TODO: add documentation here
|
50
|
-
def authentasaurus_authorizable(*opts)
|
51
|
-
options = opts.extract_options!
|
52
|
-
|
53
|
-
resources :groups, options.dup
|
54
|
-
resources :areas, options.dup
|
55
|
-
resources :permissions, options.dup
|
56
|
-
end
|
57
|
-
|
58
|
-
# TODO: add documentation here
|
59
|
-
def authentasaurus_validatable
|
60
|
-
match "/validate" => "validations#validate", :as => 'validate'
|
61
|
-
match "/activate" => "validations#activate", :as => 'activate'
|
62
|
-
match "/resend-validation" => "validations#resend_validation_email", :via => :get, :as => 'recover_password'
|
63
|
-
match "/resend-validation" => "validations#do_resend_validation_email", :via => :post, :as => 'do_recover_password'
|
64
|
-
end
|
65
|
-
|
66
|
-
# TODO: add documentation here
|
67
|
-
def authentasaurus_invitable(*opts)
|
68
|
-
options = opts.extract_options!
|
69
|
-
|
70
|
-
resources :user_invitations, options.dup.merge({:except => [:show, :edit, :update]})
|
71
|
-
end
|
72
|
-
|
73
|
-
def authentasaurus_invitable_public(*opts)
|
74
|
-
options = opts.extract_options!
|
75
|
-
|
76
|
-
resources :registrations, :only => [:new, :create], :path_prefix => "/:token", :requirements => {:token => /[0-9a-zA-Z]+/}
|
77
|
-
end
|
78
|
-
|
79
|
-
# TODO: add documentation here
|
80
|
-
def authentasaurus_recoverable
|
81
|
-
match "/forgot-password" => "recoveries#new", :via => :get, :as => 'forgot_password'
|
82
|
-
match "/forgot-password" => "recoveries#create", :via => :post, :as => 'do_forgot_password'
|
83
|
-
match "/recover-password/:token" => "recoveries#edit", :via => :get, :as => 'recover_password'
|
84
|
-
match "/recover-password/:token" => "recoveries#destroy", :via => :delete, :as => 'do_recover_password'
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|