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 +4 -4
- data/README.md +8 -0
- data/lib/snfoil/context/version.rb +1 -1
- data/lib/snfoil/context.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c0a135f165751090edfb064b8af3fe1290c8d4a43826dd1e613e466d0c70632
|
4
|
+
data.tar.gz: c1c7e5e532f45c44b387a7ac783d5d4c861287184e0fab76778d9314d72c325e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/snfoil/context.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
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:
|
12
|
+
date: 2023-03-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|