snfoil-context 1.1.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7668d6bc2b0b4cb145b6e68854fdcefa1189dcd22705ff653175eb6ca9f17343
4
- data.tar.gz: 422d2f4379b13c67c724169d86bc040e0630fd152ed7cd31527b13303a147839
3
+ metadata.gz: 3c0a135f165751090edfb064b8af3fe1290c8d4a43826dd1e613e466d0c70632
4
+ data.tar.gz: c1c7e5e532f45c44b387a7ac783d5d4c861287184e0fab76778d9314d72c325e
5
5
  SHA512:
6
- metadata.gz: 94724380046a655bec5ce557847b3930945d6bbadba09f37041f48a2a494698adc851d20cf9166458944782e339adbef586d4dbb397134d0d6f31d8357462d68
7
- data.tar.gz: 8bad4f8f72c130e25cf2c12c3123bbf2cf8b7652a2219cdc5503e422d6329c75ad864a11bbb7cf9aa8aecb3a78c9cc64fcdf8bcea180d6146a79c1494e320bca
6
+ metadata.gz: '00820f4a6801a17d7979b0c8d4ebd8b55ae8f21112e5816ba1b7df8b77baf91a27b596234993474e9bac85208882b23c0d57b203caa93195aaf53a01f5de7b67'
7
+ data.tar.gz: 0f60091640051b9e57ab235abb479bb9d02d495ab27aa0186476cf0d856372560e33ec344476548b80790e1e1a8305cfa4749a109f022d50d739511b2e2aed08
data/README.md CHANGED
@@ -309,6 +309,14 @@ end
309
309
  #### Why before and after?
310
310
  Simply to make sure the entity is allowed access to the primary target and is allowed to make the requested alterations/interactions.
311
311
 
312
+ #### Did Authorize Run?
313
+ If there is a valid policy to call SnFoil-Context will update the `:authorize` key in the options.
314
+
315
+ Values are:
316
+ - `false` - The authorize method never ran
317
+ - `:setup` - The authorize method ran after the setup interval (the first run)
318
+ - `:before` - The authorize method ran after the before interval (the second run)
319
+
312
320
  ### Intervals
313
321
  There might be a situation where you don't need a before, after, success or failure, and just need a single name pipeline you can hook into. `interval` allows you to create a single action-like segment.
314
322
 
@@ -16,6 +16,6 @@
16
16
 
17
17
  module SnFoil
18
18
  module Context
19
- VERSION = '1.1.0'
19
+ VERSION = '1.2.1'
20
20
  end
21
21
  end
@@ -76,10 +76,12 @@ module SnFoil
76
76
  options[:action] ||= name.to_sym
77
77
 
78
78
  options = run_interval(format('setup_%s', name), **options)
79
- authorize(name, **options) if respond_to?(:authorize)
79
+
80
+ authorize(name, **options) if respond_to?(:authorize) && !options[:skip_first_authorize]
80
81
 
81
82
  options = run_interval(format('before_%s', name), **options)
82
- authorize(name, **options) if respond_to?(:authorize)
83
+
84
+ authorize(name, **options) if respond_to?(:authorize) && !options[:skip_last_authorize]
83
85
 
84
86
  options = if run_action_primary(method, block, **options)
85
87
  run_interval(format('after_%s_success', name), **options)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snfoil-context
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Howes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-10-05 00:00:00.000000000 Z
12
+ date: 2023-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport