Module: Authentasaurus::Ac::Routing::InstanceMethods

Defined in:
lib/authentasaurus/ac/routing.rb

Instance Method Summary collapse

Instance Method Details

#authentasaurus_authorizable(*opts) ⇒ Object

TODO: add documentation here



52
53
54
55
56
57
58
# File 'lib/authentasaurus/ac/routing.rb', line 52

def authentasaurus_authorizable(*opts)
  options = opts.extract_options!
  
  resources :groups, options.dup
  resources :areas, options.dup
  resources :permissions, options.dup
end

#authentasaurus_invitable(*opts) ⇒ Object

TODO: add documentation here



69
70
71
72
73
# File 'lib/authentasaurus/ac/routing.rb', line 69

def authentasaurus_invitable(*opts)
  options = opts.extract_options!
  
  resources :user_invitations, options.dup.merge({:except => [:show, :edit, :update]})
end

#authentasaurus_invitable_public(*opts) ⇒ Object



75
76
77
78
79
# File 'lib/authentasaurus/ac/routing.rb', line 75

def authentasaurus_invitable_public(*opts)
  options = opts.extract_options!
  
  resources :registrations, :only => [:new, :create], :path_prefix => "/:token", :requirements => {:token => /[0-9a-zA-Z]+/}
end

#authentasaurus_recoverableObject

TODO: add documentation here



82
83
84
85
86
87
# File 'lib/authentasaurus/ac/routing.rb', line 82

def authentasaurus_recoverable      
  match "/forgot-password" => "recoveries#new", :via => :get, :as => 'forgot_password'
  match "/forgot-password" => "recoveries#create", :via => :post, :as => 'do_forgot_password'
  match "/recover-password/:token" => "recoveries#edit", :via => :get, :as => 'recover_password'
  match "/recover-password/:token" => "recoveries#destroy", :via => :delete, :as => 'do_recover_password'
end

#authentasaurus_routes(*opts) ⇒ Object

TODO: add documentation here



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/authentasaurus/ac/routing.rb', line 10

def authentasaurus_routes(*opts)
  options = opts.extract_options!
  
  # Authenticatable
  authentasaurus_sessions options.dup
  authentasaurus_users options.dup
  # Recoverable
  authentasaurus_recoverable
  
  # Authorizable
  if opts.include?(:authorization)
    authentasaurus_authorizable options.dup
  end
  
  # Validatable
  if opts.include?(:validation)
    authentasaurus_validatable
  end
  
  # Invitable
  if opts.include?(:invitation)
    authentasaurus_invitable options.dup
    authentasaurus_invitable_public
  end
end

#authentasaurus_sessions(*opts) ⇒ Object

TODO: add documentation here



37
38
39
40
41
42
# File 'lib/authentasaurus/ac/routing.rb', line 37

def authentasaurus_sessions(*opts)
  get     "/sessions/sign-in(.:format)" => "sessions#new", :as => :new_session
  post    "/sessions(.:format)" => "sessions#create", :as => :sessions
  delete  "/sessions/sign-out(.:format)" => "sessions#destroy", :as => :session
  get     "/sessions/no-access(.:format)" => "sessions#no_access", :as => :no_access_sessions
end

#authentasaurus_users(*opts) ⇒ Object

TODO: add documentation here



45
46
47
48
49
# File 'lib/authentasaurus/ac/routing.rb', line 45

def authentasaurus_users(*opts)
  options = opts.extract_options!
  
  resources :users, options.dup
end

#authentasaurus_validatableObject

TODO: add documentation here



61
62
63
64
65
66
# File 'lib/authentasaurus/ac/routing.rb', line 61

def authentasaurus_validatable
  match "/validate" => "validations#validate", :as => 'validate'
  match "/activate" => "validations#activate", :as => 'activate'
  match "/resend-validation" => "validations#resend_validation_email", :via => :get, :as => 'recover_password'
  match "/resend-validation" => "validations#do_resend_validation_email", :via => :post, :as => 'do_recover_password'
end