56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
|
# File 'lib/auth/rails/routes.rb', line 56
def mount_routes(app_route_resources)
resources :search, :controller => "auth/search" do
collection do
get 'authenticated_user_search', :action => 'authenticated_user_search', :as => "authenticated_user"
end
end
resources :bar_codes, :controller => "auth/shopping/bar_codes", :only => [:show, :index, :new]
resources :assemblies, :controller => Auth.configuration.assembly_controller
resources :stages, :controller => Auth.configuration.stage_controller
resources :sops, :controller => Auth.configuration.sop_controller
resources :steps, :controller => Auth.configuration.step_controller
namespace :workflow do
resources :orders, :controller => Auth.configuration.order_controller
end
resources :requirements, :controller => Auth.configuration.requirement_controller
resources :states, :controller => Auth.configuration.state_controller
resources :locations, :controller => Auth.configuration.location_controller
resources :schedules, :controller => Auth.configuration.schedule_controller
resources :bookings, :controller => Auth.configuration.booking_controller
resources :slots, :controller => Auth.configuration.slot_controller
resources :overlaps, :controller => Auth.configuration.overlap_controller
resources :minutes, :controller => Auth.configuration.minute_controller
resources :entities, :controller => Auth.configuration.entity_controller
resources :specifications, :controller => Auth.configuration.specification_controller
resources :admin_create_users, :controller => "auth/admin_create_users"
resources :clients, :controller => "auth/clients", :as => "auth_clients"
resources :endpoints, :controller => Auth.configuration.endpoint_controller
resources :profiles, :controller => Auth.configuration.profiles_controller do
collection do
put ':resource/set_proxy_user', :action => 'set_proxy_resource', :as => "set_proxy_resource"
get 'credential_exists', :action => 'credential_exists'
post ':resource/get_user_id', :action => 'get_user_id'
put ':resource/update', :action => 'update'
end
end
if Auth.configuration.otp_controller
get "#{Auth.configuration.mount_path}/:resource/otp_verification_result", :action => "otp_verification_result", :controller => "#{Auth.configuration.otp_controller}", :as => "otp_verification_result"
get "#{Auth.configuration.mount_path}/:resource/verify_otp", :action => "verify_otp", :controller => "#{Auth.configuration.otp_controller}", :as => "verify_otp"
get "#{Auth.configuration.mount_path}/:resource/send_sms_otp", :action => "send_sms_otp", :controller => "#{Auth.configuration.otp_controller}", :as => "send_sms_otp"
get "#{Auth.configuration.mount_path}/:resource/resend_sms_otp", :action => "resend_sms_otp", :controller => "#{Auth.configuration.otp_controller}", :as => "resend_sms_otp"
end
["cart_item","cart","payment","product","discount","place","personality","image","bullet","instruction","communication"].each do |model|
if Auth.configuration.send("#{model}_controller")
scope_path = get_scope(model)
as_prefix = get_prefix(model)
collection = get_collection(model)
controller_name = get_controller(model)
if collection
if model == "bullet"
resources collection.to_sym, controller: controller_name, path: "/auth/work/bullets"
elsif model == "instruction"
resources collection.to_sym, controller: controller_name, path: "/auth/work/instructions"
elsif model == "communication"
resources collection.to_sym, controller: controller_name, path: "/auth/work/communications"
else
scope :path => scope_path, :as => as_prefix do
resources collection.to_sym, controller: controller_name do
collection do
if ((model == "personality") || (model == "place"))
get 'search', :action => 'search'
end
end
collection do
if model == "cart_item"
post 'create_multiple', :action => 'create_multiple'
post 'create_many_items', :action => 'create_many_items'
end
end
end
end
end
end
end
end
app_route_resources.each do |resource,opts|
opts[:controllers] ||= {}
opts[:skip] ||= []
sessions_ctrl = opts[:controllers][:sessions] || "auth/sessions"
registrations_ctrl = opts[:controllers][:registrations] || "auth/registrations"
passwords_ctrl = opts[:controllers][:passwords] || "auth/passwords"
confirmations_ctrl = opts[:controllers][:confirmations] || "auth/confirmations"
omniauth_ctrl = opts[:controllers][:omniauth_callbacks] || "auth/omniauth_callbacks"
unlocks_ctrl = opts[:controllers][:unlocks] || "auth/unlocks"
controllers = {:sessions => sessions_ctrl,
:registrations => registrations_ctrl,
:passwords => passwords_ctrl,
:confirmations => confirmations_ctrl,
:unlocks => unlocks_ctrl
}
opts[:skip].each{|item| controllers.delete(item)}
resource_as_pluralized_string = Auth::OmniAuth::Path.resource_pluralized(resource)
devise_for resource_as_pluralized_string.to_sym,
:class_name => resource,
:module => :devise,
:path => "#{Auth::OmniAuth::Path.resource_path(resource)}",
:controllers => controllers,
:skip => opts[:skip] + [:omniauth_callbacks]
resource_class = Object.const_get resource
if !(opts[:skip].include? :omniauthable)
resource_class.omniauth_providers.each do |provider|
omniauth_request_path = Auth::OmniAuth::Path.omniauth_request_path(nil,provider)
common_callback_path = Auth::OmniAuth::Path.common_callback_path(provider)
if !Rails.application.routes.url_helpers.method_defined?("#{provider}_omniauth_authorize_path".to_sym)
match "#{omniauth_request_path}", controller: omniauth_ctrl, action: "passthru", via: [:get,:post], as: "#{provider}_omniauth_authorize"
end
if !Rails.application.routes.url_helpers.method_defined?("#{provider}_omniauth_callback_path".to_sym)
match "#{common_callback_path}", controller: omniauth_ctrl, action: "omni_common", via: [:get,:post], as: "#{provider}_omniauth_callback"
end
end
oauth_failure_route_path = Auth::OmniAuth::Path.omniauth_failure_route_path(nil)
if !Rails.application.routes.url_helpers.method_defined?("omniauth_failure_path".to_sym)
match "#{oauth_failure_route_path}", controller: omniauth_ctrl, action: "failure", via:[:get,:post], as: "omniauth_failure"
end
end
end
end
|