access_schema 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
data/lib/access_schema/schema.rb
CHANGED
@@ -61,11 +61,14 @@ module AccessSchema
|
|
61
61
|
def check!(namespace_name, element_name, roles, options)
|
62
62
|
|
63
63
|
existent_element = false
|
64
|
+
failed_asserts = []
|
64
65
|
|
65
66
|
allowed = for_element(namespace_name, element_name) do |element|
|
66
67
|
existent_element = true
|
67
68
|
element.allow?(roles) do |expectation|
|
68
|
-
check_assert(expectation, options)
|
69
|
+
check_assert(expectation, options).tap do |result|
|
70
|
+
failed_asserts << expectation unless result
|
71
|
+
end
|
69
72
|
end
|
70
73
|
end
|
71
74
|
|
@@ -79,6 +82,7 @@ module AccessSchema
|
|
79
82
|
}
|
80
83
|
|
81
84
|
unless allowed
|
85
|
+
log_payload[:failed_asserts] = failed_asserts.map(&:name)
|
82
86
|
logger.info{ "check FAILED: #{log_payload.inspect}" }
|
83
87
|
raise NotAllowedError.new(log_payload)
|
84
88
|
else
|
@@ -70,7 +70,7 @@ describe AccessSchema::Schema, "errors rising" do
|
|
70
70
|
it "logs check fail with info level" do
|
71
71
|
@logger.log_only_level = "info"
|
72
72
|
@schema.allow? "Review", :mark_featured, :none
|
73
|
-
@logger.output.should == "AccessSchema: check FAILED: {:resource=>:Review, :privilege=>:mark_featured, :roles=>[:none], :options=>{}}"
|
73
|
+
@logger.output.should == "AccessSchema: check FAILED: {:resource=>:Review, :privilege=>:mark_featured, :roles=>[:none], :options=>{}, :failed_asserts=>[]}"
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: access_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -69,7 +69,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
69
|
version: '0'
|
70
70
|
segments:
|
71
71
|
- 0
|
72
|
-
hash: -
|
72
|
+
hash: -1329279297250315893
|
73
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: '0'
|
79
79
|
segments:
|
80
80
|
- 0
|
81
|
-
hash: -
|
81
|
+
hash: -1329279297250315893
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project: access_schema
|
84
84
|
rubygems_version: 1.8.16
|