action_authorization 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.
- checksums.yaml +4 -4
- data/lib/action_authorization/base_policy.rb +13 -1
- data/lib/action_authorization/version.rb +1 -1
- data/lib/action_authorization.rb +2 -1
- metadata +11 -86
- data/.gitignore +0 -10
- data/.travis.yml +0 -14
- data/Gemfile +0 -10
- data/Guardfile +0 -5
- data/LICENSE.txt +0 -21
- data/action_authorization.gemspec +0 -31
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8db241a524b3efac2f3bc9bb6b7120964bad8c2b3579cb7e995eaa1f2fb6769
|
4
|
+
data.tar.gz: 3b290a3e506102c966d72b1d50a3ce79601131eb57a8c43b1fb0d8abfaeae9d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d885298da22ba1f83a3d476e9919176b00be7c1af51d7809e32b2a64a35ca792729f76a68071fe4398f55be133508d24d57c7b3065127d1e083910d1f0d7e244
|
7
|
+
data.tar.gz: 7537d47e65899fc07b30780518f6144be9ede5fad9cce0dd743f4a6ee7ddc197b20b50032538f20518f8ecc69a4f3456f20b3021e0a3bcf32998eac68f4a5ebe
|
@@ -2,6 +2,18 @@ module ActionAuthorization
|
|
2
2
|
class BasePolicy
|
3
3
|
attr_accessor :user, :object
|
4
4
|
|
5
|
+
def self.type
|
6
|
+
name.gsub('Policy', '')
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.type_class
|
10
|
+
type.constantize
|
11
|
+
rescue NameError
|
12
|
+
NilClass
|
13
|
+
end
|
14
|
+
|
15
|
+
delegate :type, :type_class, to: :class
|
16
|
+
|
5
17
|
def initialize(user, object)
|
6
18
|
self.user = user
|
7
19
|
self.object = object
|
@@ -9,7 +21,7 @@ module ActionAuthorization
|
|
9
21
|
|
10
22
|
# create alias to object from subclass name
|
11
23
|
def self.inherited(klass)
|
12
|
-
klass.send(:alias_method, klass.
|
24
|
+
klass.send(:alias_method, klass.type.underscore, :object)
|
13
25
|
end
|
14
26
|
|
15
27
|
def index?
|
data/lib/action_authorization.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
require "active_support/core_ext/module/delegation"
|
2
|
+
require "active_support/core_ext/string/inflections"
|
1
3
|
require "action_authorization/version"
|
2
4
|
require "action_authorization/base_policy"
|
3
5
|
require "action_authorization/authorization_failure"
|
4
|
-
require "active_support/core_ext/string/inflections"
|
5
6
|
|
6
7
|
module ActionAuthorization
|
7
8
|
def self.included(base)
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_authorization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Baldwin
|
8
|
-
|
9
|
-
|
8
|
+
- Brightways Learning
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2023-01-05 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: activesupport
|
@@ -24,76 +25,6 @@ dependencies:
|
|
24
25
|
- - ">="
|
25
26
|
- !ruby/object:Gem::Version
|
26
27
|
version: '5.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.14'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.14'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '12.1'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '12.1'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: minitest
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '5.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '5.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: guard
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '2.14'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '2.14'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: guard-minitest
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '2.4'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '2.4'
|
97
28
|
description: A base policy class for authorizing controller actions with access to
|
98
29
|
the current_user and object.
|
99
30
|
email:
|
@@ -102,16 +33,8 @@ executables: []
|
|
102
33
|
extensions: []
|
103
34
|
extra_rdoc_files: []
|
104
35
|
files:
|
105
|
-
- ".gitignore"
|
106
|
-
- ".travis.yml"
|
107
|
-
- Gemfile
|
108
|
-
- Guardfile
|
109
|
-
- LICENSE.txt
|
110
36
|
- README.md
|
111
37
|
- Rakefile
|
112
|
-
- action_authorization.gemspec
|
113
|
-
- bin/console
|
114
|
-
- bin/setup
|
115
38
|
- lib/action_authorization.rb
|
116
39
|
- lib/action_authorization/authorization_failure.rb
|
117
40
|
- lib/action_authorization/base_policy.rb
|
@@ -119,8 +42,10 @@ files:
|
|
119
42
|
homepage: https://github.com/wwidea/action_authorization
|
120
43
|
licenses:
|
121
44
|
- MIT
|
122
|
-
metadata:
|
123
|
-
|
45
|
+
metadata:
|
46
|
+
homepage_uri: https://github.com/wwidea/action_authorization
|
47
|
+
source_code_uri: https://github.com/wwidea/action_authorization
|
48
|
+
post_install_message:
|
124
49
|
rdoc_options: []
|
125
50
|
require_paths:
|
126
51
|
- lib
|
@@ -135,8 +60,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
60
|
- !ruby/object:Gem::Version
|
136
61
|
version: '0'
|
137
62
|
requirements: []
|
138
|
-
rubygems_version: 3.
|
139
|
-
signing_key:
|
63
|
+
rubygems_version: 3.2.15
|
64
|
+
signing_key:
|
140
65
|
specification_version: 4
|
141
66
|
summary: Rails controller object-level action authorization.
|
142
67
|
test_files: []
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
env:
|
2
|
-
global:
|
3
|
-
- CC_TEST_REPORTER_ID=0ff5e542d77e2710a003d2ee7a11d4e5a50aaa08fe97ab009a72768885197905
|
4
|
-
language: ruby
|
5
|
-
rvm:
|
6
|
-
- 2.5.1
|
7
|
-
before_script:
|
8
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
9
|
-
- chmod +x ./cc-test-reporter
|
10
|
-
- ./cc-test-reporter before-build
|
11
|
-
script:
|
12
|
-
- bundle exec rake test
|
13
|
-
after_script:
|
14
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/Gemfile
DELETED
data/Guardfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2017 Aaron Baldwin
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'action_authorization/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "action_authorization"
|
8
|
-
spec.version = ActionAuthorization::VERSION
|
9
|
-
spec.authors = ["Aaron Baldwin"]
|
10
|
-
spec.email = ["baldwina@brightwayslearning.org"]
|
11
|
-
|
12
|
-
spec.summary = %q{Rails controller object-level action authorization.}
|
13
|
-
spec.description = %q{A base policy class for authorizing controller actions with access to the current_user and object.}
|
14
|
-
spec.homepage = "https://github.com/wwidea/action_authorization"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
-
f.match(%r{^(test|spec|features)/})
|
19
|
-
end
|
20
|
-
spec.bindir = "exe"
|
21
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
-
spec.require_paths = ["lib"]
|
23
|
-
|
24
|
-
spec.add_runtime_dependency "activesupport", ">= 5.0"
|
25
|
-
|
26
|
-
spec.add_development_dependency "bundler", "~> 1.14"
|
27
|
-
spec.add_development_dependency "rake", "~> 12.1"
|
28
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
29
|
-
spec.add_development_dependency "guard", "~> 2.14"
|
30
|
-
spec.add_development_dependency "guard-minitest", "~> 2.4"
|
31
|
-
end
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "action_authorization"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|