controlist 0.1.0 → 0.2.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 869f2a6dde29f0147539df3d68e2ac711cc13455
|
4
|
+
data.tar.gz: bdc0da9ca4091b91573da88c9fbf42082e20869f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d0ec5252374ad3c4f564520f762640fd3e33e397e75f3f6fb72fe501c3143ea66e1db258ae4e03847c5c04a9171eb3e7bc379340262737acbba4d3ab0be8d02
|
7
|
+
data.tar.gz: 9669e13a1bc8fc97a7f1c85862cae8a1f15471c3d2451293222b83c7bc8997ddbf2a54e1b13b761515e053df836ad2d6d1f625334b1dcc96abf0fa01c7c86191
|
@@ -3,11 +3,9 @@ module Controlist
|
|
3
3
|
|
4
4
|
class SimpleConstrain < Constrain
|
5
5
|
|
6
|
-
def initialize(property, value
|
6
|
+
def initialize(property, value)
|
7
7
|
self.property = property.to_s
|
8
8
|
self.value = value
|
9
|
-
self.relation = hash[:relation]
|
10
|
-
self.table_name = hash[:table_name]
|
11
9
|
end
|
12
10
|
|
13
11
|
end
|
data/lib/controlist/version.rb
CHANGED
data/test/feature_test.rb
CHANGED
@@ -23,7 +23,7 @@ class FeatureTest < ActiveSupport::TestCase
|
|
23
23
|
Controlist.permission_provider.set_permission_package(OrderedPackage.new(
|
24
24
|
Controlist::Permission.new(User, READ, true, [
|
25
25
|
SimpleConstrain.new("name", "Tom"),
|
26
|
-
|
26
|
+
AdvancedConstrain.new(property: "name", value: ["Grade 1", "Grade 2"], relation: "clazz"),
|
27
27
|
AdvancedConstrain.new(property: "age", value: 5, operator: ">="),
|
28
28
|
SimpleConstrain.new("age", "null"),
|
29
29
|
SimpleConstrain.new("age", [1,2,3]),
|
@@ -96,15 +96,15 @@ class FeatureTest < ActiveSupport::TestCase
|
|
96
96
|
Controlist::Permission.new(Clazz, READ),
|
97
97
|
Controlist::Permission.new(User, READ),
|
98
98
|
Controlist::Permission.new(User, UPDATE, false, AdvancedConstrain.new(property: "name", value: "To", operator: "include?")),
|
99
|
-
Controlist.is_activerecord3? ? nil : Controlist::Permission.new(User, UPDATE, false, AdvancedConstrain.new(proc_persistence: lambda{|object, operation| object.name ==
|
100
|
-
Controlist::Permission.new(User, [UPDATE, DELETE], false,
|
99
|
+
Controlist.is_activerecord3? ? nil : Controlist::Permission.new(User, UPDATE, false, AdvancedConstrain.new(proc_persistence: lambda{|object, operation| object.name == "Block"})),
|
100
|
+
Controlist::Permission.new(User, [UPDATE, DELETE], false, AdvancedConstrain.new(property: "name", value: "Grade 1", relation: "clazz")),
|
101
101
|
Controlist::Permission.new(User, UPDATE)
|
102
102
|
))
|
103
103
|
|
104
104
|
user = User.find 3
|
105
105
|
assert_not_equal "Tom", user.name
|
106
106
|
assert_not_equal "Grade 1", user.clazz.name
|
107
|
-
user.name =
|
107
|
+
user.name = "Test"
|
108
108
|
assert_equal true, user.save
|
109
109
|
|
110
110
|
unless Controlist.is_activerecord3?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: controlist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leon Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|