strong_actions 0.0.2 → 0.0.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -44
- data/README.md +25 -8
- data/lib/strong_actions/{controller_extentions.rb → controller_extensions.rb} +1 -1
- data/lib/strong_actions/railtie.rb +1 -1
- data/lib/strong_actions/version.rb +1 -1
- data/lib/strong_actions.rb +1 -1
- data/strong_actions.gemspec +4 -1
- metadata +55 -16
- data/LICENSE.txt +0 -22
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 33b2e12b49fba4ce6ffdc958dcffb10f3488e7eb
         | 
| 4 | 
            +
              data.tar.gz: 5ae09785037dff9dae2907cb6f35ac0af28ff100
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d7abda3d916eb50633e65d1a7a66f3bc86332f53e766ae125ec17bdcb2d621e1e2c7456c814b13b54a4024428498e63c1792dd5c60b1559e361b732453631d28
         | 
| 7 | 
            +
              data.tar.gz: 05396c0b7f028c12168adfbb6748294ae129d82db55388b4ec518f86c7b8711babe249922135b25afaad347c2e2e621e9cb9700e14397aae0676959d30dddb5d
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,15 +1,14 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                strong_actions (0.0. | 
| 4 | 
            +
                strong_actions (0.0.3)
         | 
| 5 | 
            +
                  actionpack (>= 3.2.0, < 5.0.0)
         | 
| 6 | 
            +
                  activesupport (>= 3.2.0, < 5.0.0)
         | 
| 7 | 
            +
                  railties (>= 3.2.0, < 5.0.0)
         | 
| 5 8 |  | 
| 6 9 | 
             
            GEM
         | 
| 7 10 | 
             
              remote: https://rubygems.org/
         | 
| 8 11 | 
             
              specs:
         | 
| 9 | 
            -
                actionmailer (4.1.5)
         | 
| 10 | 
            -
                  actionpack (= 4.1.5)
         | 
| 11 | 
            -
                  actionview (= 4.1.5)
         | 
| 12 | 
            -
                  mail (~> 2.5.4)
         | 
| 13 12 | 
             
                actionpack (4.1.5)
         | 
| 14 13 | 
             
                  actionview (= 4.1.5)
         | 
| 15 14 | 
             
                  activesupport (= 4.1.5)
         | 
| @@ -19,66 +18,28 @@ GEM | |
| 19 18 | 
             
                  activesupport (= 4.1.5)
         | 
| 20 19 | 
             
                  builder (~> 3.1)
         | 
| 21 20 | 
             
                  erubis (~> 2.7.0)
         | 
| 22 | 
            -
                activemodel (4.1.5)
         | 
| 23 | 
            -
                  activesupport (= 4.1.5)
         | 
| 24 | 
            -
                  builder (~> 3.1)
         | 
| 25 | 
            -
                activerecord (4.1.5)
         | 
| 26 | 
            -
                  activemodel (= 4.1.5)
         | 
| 27 | 
            -
                  activesupport (= 4.1.5)
         | 
| 28 | 
            -
                  arel (~> 5.0.0)
         | 
| 29 21 | 
             
                activesupport (4.1.5)
         | 
| 30 22 | 
             
                  i18n (~> 0.6, >= 0.6.9)
         | 
| 31 23 | 
             
                  json (~> 1.7, >= 1.7.7)
         | 
| 32 24 | 
             
                  minitest (~> 5.1)
         | 
| 33 25 | 
             
                  thread_safe (~> 0.1)
         | 
| 34 26 | 
             
                  tzinfo (~> 1.1)
         | 
| 35 | 
            -
                arel (5.0.1.20140414130214)
         | 
| 36 27 | 
             
                builder (3.2.2)
         | 
| 37 28 | 
             
                erubis (2.7.0)
         | 
| 38 | 
            -
                hike (1.2.3)
         | 
| 39 29 | 
             
                i18n (0.6.11)
         | 
| 40 30 | 
             
                json (1.8.1)
         | 
| 41 | 
            -
                mail (2.5.4)
         | 
| 42 | 
            -
                  mime-types (~> 1.16)
         | 
| 43 | 
            -
                  treetop (~> 1.4.8)
         | 
| 44 | 
            -
                mime-types (1.25.1)
         | 
| 45 31 | 
             
                minitest (5.4.1)
         | 
| 46 | 
            -
                multi_json (1.10.1)
         | 
| 47 | 
            -
                polyglot (0.3.5)
         | 
| 48 32 | 
             
                rack (1.5.2)
         | 
| 49 33 | 
             
                rack-test (0.6.2)
         | 
| 50 34 | 
             
                  rack (>= 1.0)
         | 
| 51 | 
            -
                rails (4.1.5)
         | 
| 52 | 
            -
                  actionmailer (= 4.1.5)
         | 
| 53 | 
            -
                  actionpack (= 4.1.5)
         | 
| 54 | 
            -
                  actionview (= 4.1.5)
         | 
| 55 | 
            -
                  activemodel (= 4.1.5)
         | 
| 56 | 
            -
                  activerecord (= 4.1.5)
         | 
| 57 | 
            -
                  activesupport (= 4.1.5)
         | 
| 58 | 
            -
                  bundler (>= 1.3.0, < 2.0)
         | 
| 59 | 
            -
                  railties (= 4.1.5)
         | 
| 60 | 
            -
                  sprockets-rails (~> 2.0)
         | 
| 61 35 | 
             
                railties (4.1.5)
         | 
| 62 36 | 
             
                  actionpack (= 4.1.5)
         | 
| 63 37 | 
             
                  activesupport (= 4.1.5)
         | 
| 64 38 | 
             
                  rake (>= 0.8.7)
         | 
| 65 39 | 
             
                  thor (>= 0.18.1, < 2.0)
         | 
| 66 40 | 
             
                rake (10.3.2)
         | 
| 67 | 
            -
                sprockets (2.12.1)
         | 
| 68 | 
            -
                  hike (~> 1.2)
         | 
| 69 | 
            -
                  multi_json (~> 1.0)
         | 
| 70 | 
            -
                  rack (~> 1.0)
         | 
| 71 | 
            -
                  tilt (~> 1.1, != 1.3.0)
         | 
| 72 | 
            -
                sprockets-rails (2.1.3)
         | 
| 73 | 
            -
                  actionpack (>= 3.0)
         | 
| 74 | 
            -
                  activesupport (>= 3.0)
         | 
| 75 | 
            -
                  sprockets (~> 2.8)
         | 
| 76 41 | 
             
                thor (0.19.1)
         | 
| 77 42 | 
             
                thread_safe (0.3.4)
         | 
| 78 | 
            -
                tilt (1.4.1)
         | 
| 79 | 
            -
                treetop (1.4.15)
         | 
| 80 | 
            -
                  polyglot
         | 
| 81 | 
            -
                  polyglot (>= 0.3.1)
         | 
| 82 43 | 
             
                tzinfo (1.2.2)
         | 
| 83 44 | 
             
                  thread_safe (~> 0.1)
         | 
| 84 45 |  | 
| @@ -87,6 +48,5 @@ PLATFORMS | |
| 87 48 |  | 
| 88 49 | 
             
            DEPENDENCIES
         | 
| 89 50 | 
             
              bundler (~> 1.6)
         | 
| 90 | 
            -
              rails (>= 3.2.0, < 5.0.0)
         | 
| 91 51 | 
             
              rake
         | 
| 92 52 | 
             
              strong_actions!
         | 
    
        data/README.md
    CHANGED
    
    | @@ -18,6 +18,9 @@ Or install it yourself as: | |
| 18 18 |  | 
| 19 19 | 
             
            ## Usage
         | 
| 20 20 |  | 
| 21 | 
            +
             | 
| 22 | 
            +
            ### Configuration
         | 
| 23 | 
            +
             | 
| 21 24 | 
             
            Suppose method "current_user" is available for controllers and views,
         | 
| 22 25 |  | 
| 23 26 | 
             
            and user has an attribute called admin and only admin can modify resource "users",
         | 
| @@ -25,14 +28,28 @@ and user has an attribute called admin and only admin can modify resource "users | |
| 25 28 | 
             
            then prepare config/acl.yml
         | 
| 26 29 |  | 
| 27 30 | 
             
                current_user:
         | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
            In  | 
| 31 | 
            +
                  users:
         | 
| 32 | 
            +
                    new: admin?
         | 
| 33 | 
            +
                    create: admin?
         | 
| 34 | 
            +
                    edit: admin?
         | 
| 35 | 
            +
                    update: admin?
         | 
| 36 | 
            +
                    destroy: admin?
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            In above case, when a non-admin user try to access new_user_path, StrongActions::ForbiddenAction is thrown.
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            ### Handling error in controller
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            In application_controller.rb, the error should be rescued like
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                rescue_from StrongActions::ForbiddenAction do
         | 
| 45 | 
            +
                  render :file => 'public/403.html', :layout => false, :status => :forbidden
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            In above case, all the forbidden accesses are handled by public/403.html.
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            ### Disabling forbidden link in view
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            In views, use helper method "available?" so that links for forbidden actions are not shown.
         | 
| 36 53 |  | 
| 37 54 | 
             
                <%= link_to 'Add User' new_user_path if available?('users', 'new') %>
         | 
| 38 55 |  | 
    
        data/lib/strong_actions.rb
    CHANGED
    
    
    
        data/strong_actions.gemspec
    CHANGED
    
    | @@ -17,7 +17,10 @@ Gem::Specification.new do |spec| | |
| 17 17 | 
             
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| 18 18 | 
             
              spec.require_paths = ["lib"]
         | 
| 19 19 |  | 
| 20 | 
            +
              spec.add_dependency "activesupport", '>= 3.2.0', '< 5.0.0'
         | 
| 21 | 
            +
              spec.add_dependency "actionpack", '>= 3.2.0', '< 5.0.0'
         | 
| 22 | 
            +
              spec.add_dependency "railties", '>= 3.2.0', '< 5.0.0'
         | 
| 23 | 
            +
             | 
| 20 24 | 
             
              spec.add_development_dependency "bundler", "~> 1.6"
         | 
| 21 25 | 
             
              spec.add_development_dependency "rake"
         | 
| 22 | 
            -
              spec.add_development_dependency 'rails', '>= 3.2.0', '< 5.0.0'
         | 
| 23 26 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,45 +1,57 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: strong_actions
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - ichy
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014- | 
| 11 | 
            +
            date: 2014-09-06 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            -
              name:  | 
| 14 | 
            +
              name: activesupport
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 | 
            -
                - -  | 
| 17 | 
            +
                - - '>='
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version:  | 
| 20 | 
            -
             | 
| 19 | 
            +
                    version: 3.2.0
         | 
| 20 | 
            +
                - - <
         | 
| 21 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 22 | 
            +
                    version: 5.0.0
         | 
| 23 | 
            +
              type: :runtime
         | 
| 21 24 | 
             
              prerelease: false
         | 
| 22 25 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 26 | 
             
                requirements:
         | 
| 24 | 
            -
                - -  | 
| 27 | 
            +
                - - '>='
         | 
| 25 28 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version:  | 
| 29 | 
            +
                    version: 3.2.0
         | 
| 30 | 
            +
                - - <
         | 
| 31 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 32 | 
            +
                    version: 5.0.0
         | 
| 27 33 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            -
              name:  | 
| 34 | 
            +
              name: actionpack
         | 
| 29 35 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 36 | 
             
                requirements:
         | 
| 31 37 | 
             
                - - '>='
         | 
| 32 38 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version:  | 
| 34 | 
            -
             | 
| 39 | 
            +
                    version: 3.2.0
         | 
| 40 | 
            +
                - - <
         | 
| 41 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 42 | 
            +
                    version: 5.0.0
         | 
| 43 | 
            +
              type: :runtime
         | 
| 35 44 | 
             
              prerelease: false
         | 
| 36 45 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 46 | 
             
                requirements:
         | 
| 38 47 | 
             
                - - '>='
         | 
| 39 48 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version:  | 
| 49 | 
            +
                    version: 3.2.0
         | 
| 50 | 
            +
                - - <
         | 
| 51 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 52 | 
            +
                    version: 5.0.0
         | 
| 41 53 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            -
              name:  | 
| 54 | 
            +
              name: railties
         | 
| 43 55 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 56 | 
             
                requirements:
         | 
| 45 57 | 
             
                - - '>='
         | 
| @@ -48,7 +60,7 @@ dependencies: | |
| 48 60 | 
             
                - - <
         | 
| 49 61 | 
             
                  - !ruby/object:Gem::Version
         | 
| 50 62 | 
             
                    version: 5.0.0
         | 
| 51 | 
            -
              type: : | 
| 63 | 
            +
              type: :runtime
         | 
| 52 64 | 
             
              prerelease: false
         | 
| 53 65 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 54 66 | 
             
                requirements:
         | 
| @@ -58,6 +70,34 @@ dependencies: | |
| 58 70 | 
             
                - - <
         | 
| 59 71 | 
             
                  - !ruby/object:Gem::Version
         | 
| 60 72 | 
             
                    version: 5.0.0
         | 
| 73 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 74 | 
            +
              name: bundler
         | 
| 75 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 76 | 
            +
                requirements:
         | 
| 77 | 
            +
                - - ~>
         | 
| 78 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 79 | 
            +
                    version: '1.6'
         | 
| 80 | 
            +
              type: :development
         | 
| 81 | 
            +
              prerelease: false
         | 
| 82 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 83 | 
            +
                requirements:
         | 
| 84 | 
            +
                - - ~>
         | 
| 85 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 86 | 
            +
                    version: '1.6'
         | 
| 87 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 88 | 
            +
              name: rake
         | 
| 89 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 90 | 
            +
                requirements:
         | 
| 91 | 
            +
                - - '>='
         | 
| 92 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 93 | 
            +
                    version: '0'
         | 
| 94 | 
            +
              type: :development
         | 
| 95 | 
            +
              prerelease: false
         | 
| 96 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 97 | 
            +
                requirements:
         | 
| 98 | 
            +
                - - '>='
         | 
| 99 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 100 | 
            +
                    version: '0'
         | 
| 61 101 | 
             
            description: access control for rails controller/action
         | 
| 62 102 | 
             
            email:
         | 
| 63 103 | 
             
            - ichylinux@gmail.com
         | 
| @@ -70,12 +110,11 @@ files: | |
| 70 110 | 
             
            - Gemfile.lock
         | 
| 71 111 | 
             
            - HISTORY.md
         | 
| 72 112 | 
             
            - LICENSE
         | 
| 73 | 
            -
            - LICENSE.txt
         | 
| 74 113 | 
             
            - README.md
         | 
| 75 114 | 
             
            - Rakefile
         | 
| 76 115 | 
             
            - lib/strong_actions.rb
         | 
| 77 116 | 
             
            - lib/strong_actions/config.rb
         | 
| 78 | 
            -
            - lib/strong_actions/ | 
| 117 | 
            +
            - lib/strong_actions/controller_extensions.rb
         | 
| 79 118 | 
             
            - lib/strong_actions/forbidden_action.rb
         | 
| 80 119 | 
             
            - lib/strong_actions/railtie.rb
         | 
| 81 120 | 
             
            - lib/strong_actions/version.rb
         | 
    
        data/LICENSE.txt
    DELETED
    
    | @@ -1,22 +0,0 @@ | |
| 1 | 
            -
            Copyright (c) 2014 ichy
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            MIT License
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            Permission is hereby granted, free of charge, to any person obtaining
         | 
| 6 | 
            -
            a copy of this software and associated documentation files (the
         | 
| 7 | 
            -
            "Software"), to deal in the Software without restriction, including
         | 
| 8 | 
            -
            without limitation the rights to use, copy, modify, merge, publish,
         | 
| 9 | 
            -
            distribute, sublicense, and/or sell copies of the Software, and to
         | 
| 10 | 
            -
            permit persons to whom the Software is furnished to do so, subject to
         | 
| 11 | 
            -
            the following conditions:
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            The above copyright notice and this permission notice shall be
         | 
| 14 | 
            -
            included in all copies or substantial portions of the Software.
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         | 
| 17 | 
            -
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         | 
| 18 | 
            -
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         | 
| 19 | 
            -
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         | 
| 20 | 
            -
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         | 
| 21 | 
            -
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         | 
| 22 | 
            -
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         |