diff options
author | http://jneen.net/ <jneen@jneen.net> | 2017-08-07 12:48:22 -0700 |
---|---|---|
committer | http://jneen.net/ <jneen@jneen.net> | 2017-08-07 12:48:22 -0700 |
commit | 15bb6e1ed7a4fb1d6554e193497836b79bc26bda (patch) | |
tree | d3ded32d0f4420f52b663a56ecf9da5d905062b1 | |
parent | 8a167554a9dae4ab10f5a56124a598227bf5e3ed (diff) | |
download | gitlab-ce-15bb6e1ed7a4fb1d6554e193497836b79bc26bda.tar.gz |
more eagerly bail when the state is prevented
-rw-r--r-- | lib/declarative_policy/runner.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/declarative_policy/runner.rb b/lib/declarative_policy/runner.rb index 1122b9e42ec..56afd1f1392 100644 --- a/lib/declarative_policy/runner.rb +++ b/lib/declarative_policy/runner.rb @@ -76,6 +76,8 @@ module DeclarativePolicy @state = State.new steps_by_score do |step, score| + return if !debug && @state.prevented? + passed = nil case step.action when :enable then @@ -93,10 +95,7 @@ module DeclarativePolicy # been prevented. unless @state.prevented? passed = step.pass? - if passed - @state.prevent! - return unless debug - end + @state.prevent! if passed end debug << inspect_step(step, score, passed) if debug |