access_schema 0.3.1 → 0.3.2

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.
@@ -56,6 +56,13 @@ module AccessSchema
56
56
 
57
57
  def check!(namespace_name, element_name, roles, options)
58
58
 
59
+
60
+ allowed = for_element(namespace_name, element_name) do |element|
61
+ element.allow?(roles) do |expectation|
62
+ check_assert(expectation, options)
63
+ end
64
+ end
65
+
59
66
  format_log_payload = lambda {
60
67
  [
61
68
  "namespace = '#{namespace_name}'",
@@ -65,18 +72,11 @@ module AccessSchema
65
72
  ].join(', ')
66
73
  }
67
74
 
68
- logger.debug{ "check: #{format_log_payload.call}" }
69
-
70
- allowed = for_element(namespace_name, element_name) do |element|
71
- element.allow?(roles) do |expectation|
72
- check_assert(expectation, options)
73
- end
74
- end
75
-
76
75
  unless allowed
77
76
  logger.info{ "check FAILED: #{format_log_payload.call}" }
78
77
  raise NotAlowedError.new
79
78
  else
79
+ logger.debug{ "check PASSED: #{format_log_payload.call}" }
80
80
  true
81
81
  end
82
82
 
@@ -1,3 +1,3 @@
1
1
  module AccessSchema
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -49,7 +49,7 @@ describe AccessSchema::Schema, "errors rising" do
49
49
  it "logs check arguments with debug level" do
50
50
  @logger.log_only_level = "debug"
51
51
  @schema.allow? "Review", :mark_featured, :flower
52
- @logger.output.should == "AccessSchema: check: namespace = 'Review', privilege = 'mark_featured', roles = '[:flower]', options = '{}'"
52
+ @logger.output.should == "AccessSchema: check PASSED: namespace = 'Review', privilege = 'mark_featured', roles = '[:flower]', options = '{}'"
53
53
  end
54
54
 
55
55
  it "logs check fail with info level" do
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.1
4
+ version: 0.3.2
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: -1319754727916737985
72
+ hash: -3306335106501165569
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: -1319754727916737985
81
+ hash: -3306335106501165569
82
82
  requirements: []
83
83
  rubyforge_project: access_schema
84
84
  rubygems_version: 1.8.16