logical_authz 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,17 +9,27 @@ module LogicalAuthz
9
9
 
10
10
  def redirect_to_lobby(message = nil)
11
11
  back = request.headers["Referer"]
12
- laz_debug{"Sending user back to: #{back} Authz'd?"}
13
- back_criteria = criteria_from_url(back)
14
- if back_criteria.nil?
15
- laz_debug{"Back is nil - going to the default_unauthorized_url"}
16
- redirect_to default_unauthorized_url
17
- elsif LogicalAuthz::is_authorized?(back_criteria)
12
+ laz_debug{"Sending user back to: #{back.inspect} Authz'd?"}
13
+ back_criteria = criteria_from_url(back) #because back might be foreign
14
+ if !back.nil? and authorized?(back_criteria)
18
15
  laz_debug{"Back authorized - going to #{back}"}
19
16
  redirect_to back
20
17
  else
21
- laz_debug{"Back is unauthorized - going to the default_unauthorized_url"}
22
- redirect_to default_unauthorized_url
18
+ laz_debug{
19
+ if back_criteria.nil?
20
+ "Back is nil - trying authz fallback"
21
+ else
22
+ "Back is unauthorized - trying authz fallback"
23
+ end
24
+ }
25
+ #TODO: list of fallbacks, with defaults?
26
+ if authorized_url?(default_unauthorized_url)
27
+ laz_debug{"#{default_unauthorized_url} is authz'd - redirecting"}
28
+ redirect_to default_unauthorized_url
29
+ else
30
+ laz_debug{"#{default_unauthorized_url} is NOT authz'd - redirecting to #{root_url}"}
31
+ redirect_to root_url
32
+ end
23
33
  end
24
34
  end
25
35
 
@@ -33,6 +43,7 @@ module LogicalAuthz
33
43
  redirect_to(:root, :flash => {:success => message})
34
44
  end
35
45
  end
46
+ alias redirect_retry redirect_to_last_unauthorized
36
47
 
37
48
  def strip_record(record)
38
49
  laz_debug{"Logical Authz: stripping: #{record.inspect}"}
@@ -14,5 +14,9 @@ module LogicalAuthz
14
14
  config.eager_load_paths.unshift 'app/helpers'
15
15
 
16
16
  config.logical_authz = Configuration
17
+
18
+ initializer :require_common do
19
+ require 'logical_authz/common'
20
+ end
17
21
  end
18
22
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logical_authz
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 3
10
+ version: 0.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Judson Lester
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-06 00:00:00 -07:00
18
+ date: 2011-06-10 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -191,7 +191,7 @@ rdoc_options:
191
191
  - --main
192
192
  - doc/README
193
193
  - --title
194
- - logical_authz-0.2.1 RDoc
194
+ - logical_authz-0.2.3 RDoc
195
195
  require_paths:
196
196
  - lib/
197
197
  required_ruby_version: !ruby/object:Gem::Requirement