kant 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +14 -0
- data/README.md +1 -1
- data/kant.gemspec +4 -4
- data/lib/kant/all_access.rb +1 -1
- data/lib/kant/policy_access.rb +2 -2
- data/lib/kant/version.rb +1 -1
- data/spec/kant/policy_access_spec.rb +4 -1
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1208a5ac943ff6c41e4eb13d0840c3e8b674e331b87858037bb028304295a0d5
|
4
|
+
data.tar.gz: '0019875fd523a5f12bfff8eef32a033b5c94ac3cabae65a219adba0c1e97143c'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f3ca513b5b66f00244899a5a04fa2931b6b1344ffa0342c1f79717aba3380444f9a6ad54492fb226e9511369d45352fed4962457a1405a82d278e6c5ed11f19
|
7
|
+
data.tar.gz: d75f90ad67c99e9abdbd9f31bfbf2d078734bb633f6326f4c9a88b0e32a411722453b262f2ce0103d94d1bfd8526e8f5383d67d6e6d6a14b1e9deec22fc9de3d
|
data/.travis.yml
ADDED
data/README.md
CHANGED
data/kant.gemspec
CHANGED
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler", "
|
21
|
+
spec.add_development_dependency "bundler", ">= 1.7"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
23
|
spec.add_development_dependency "rspec", "~> 3.1.0"
|
24
|
-
spec.add_development_dependency "with_model", "~>
|
25
|
-
spec.add_development_dependency "sqlite3", "
|
26
|
-
spec.add_development_dependency "activerecord", "
|
24
|
+
spec.add_development_dependency "with_model", "~> 2.1"
|
25
|
+
spec.add_development_dependency "sqlite3", ">= 1.4"
|
26
|
+
spec.add_development_dependency "activerecord", "~> 6.1"
|
27
27
|
end
|
data/lib/kant/all_access.rb
CHANGED
data/lib/kant/policy_access.rb
CHANGED
@@ -37,12 +37,12 @@ module Kant
|
|
37
37
|
#
|
38
38
|
# ability.accessible(:read, Content)
|
39
39
|
# # => a Content scope
|
40
|
-
def accessible(action, scope, *rest)
|
40
|
+
def accessible(action, scope, *rest, **kwargs)
|
41
41
|
abilities = resolve_scope(scope)
|
42
42
|
_scope_method = scope_method(abilities, action)
|
43
43
|
|
44
44
|
if _scope_method
|
45
|
-
abilities.send(_scope_method, scope, user, *rest)
|
45
|
+
abilities.send(_scope_method, scope, user, *rest, **kwargs)
|
46
46
|
else
|
47
47
|
scope.none
|
48
48
|
end
|
data/lib/kant/version.rb
CHANGED
@@ -193,7 +193,10 @@ describe Kant::PolicyAccess do
|
|
193
193
|
# end
|
194
194
|
# end
|
195
195
|
todo_policy = Class.new do
|
196
|
-
define_singleton_method(:readable_as_owner) do |todos, user,
|
196
|
+
define_singleton_method(:readable_as_owner) do |todos, user, options = {}|
|
197
|
+
project = options[:project]
|
198
|
+
fail ArgumentError if !project
|
199
|
+
|
197
200
|
if project.owner_id == user.id
|
198
201
|
todos.where(project_id: project.id, completed: true)
|
199
202
|
else
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Przepiora
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.7'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -58,42 +58,42 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '2.1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '2.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sqlite3
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: '1.4'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: '1.4'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: activerecord
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '6.1'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '6.1'
|
97
97
|
description: Kant is a tiny authorization library for your Ruby (especially Rails
|
98
98
|
and/or ActiveRecord) projects.
|
99
99
|
email:
|
@@ -103,6 +103,7 @@ extensions: []
|
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
105
|
- ".gitignore"
|
106
|
+
- ".travis.yml"
|
106
107
|
- Gemfile
|
107
108
|
- LICENSE.txt
|
108
109
|
- README.md
|
@@ -142,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
143
|
- !ruby/object:Gem::Version
|
143
144
|
version: '0'
|
144
145
|
requirements: []
|
145
|
-
|
146
|
-
rubygems_version: 2.4.5.1
|
146
|
+
rubygems_version: 3.3.26
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: A tiny, non-magical authorization library
|