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.
- data/lib/logical_authz/application.rb +19 -8
 - data/lib/logical_authz/engine.rb +4 -0
 - metadata +5 -5
 
| 
         @@ -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  
     | 
| 
       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{ 
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
      
 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}"}
         
     | 
    
        data/lib/logical_authz/engine.rb
    CHANGED
    
    
    
        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:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 17
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 2
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.2. 
     | 
| 
      
 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- 
     | 
| 
      
 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. 
     | 
| 
      
 194 
     | 
    
         
            +
            - logical_authz-0.2.3 RDoc
         
     | 
| 
       195 
195 
     | 
    
         
             
            require_paths: 
         
     | 
| 
       196 
196 
     | 
    
         
             
            - lib/
         
     | 
| 
       197 
197 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     |