Class: Kadmin::AuthConstraint
Overview
Glue class so that authentication can be added as route constraints
Instance Method Summary
collapse
#authorize, #authorized?, #authorized_user, #current_user, #logged_in?
Instance Method Details
#matches?(request) ⇒ Boolean
8
9
10
11
12
13
14
|
# File 'app/components/kadmin/auth_constraint.rb', line 8
def matches?(request)
return true unless Kadmin::Auth.config.enabled?
return with(request) do
logged_in? && authorized?
end
end
|
#request ⇒ Object
23
24
25
|
# File 'app/components/kadmin/auth_constraint.rb', line 23
def request
return @request
end
|
#session ⇒ Object
27
28
29
|
# File 'app/components/kadmin/auth_constraint.rb', line 27
def session
return request.session
end
|
#with(request) ⇒ Object
16
17
18
19
20
21
|
# File 'app/components/kadmin/auth_constraint.rb', line 16
def with(request)
@request = request
return yield
ensure
@request = nil
end
|