bro_hub 0.1.1 → 0.1.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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/controllers/bro_hub/application_controller.rb +1 -3
- data/lib/bro_hub/controller_base.rb +22 -0
- data/lib/bro_hub/version.rb +1 -1
- data/lib/bro_hub.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b1fbd1cddc86bdf0bc203daff3dbe7eab88f49d7046c2f7444b215b8a24ddee1
|
|
4
|
+
data.tar.gz: 80a631c65cf8f57fca41e6c67b059a978aef763aa9fcdc1d386634b0bae43de7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5fc326ddbfcb13bbb77adae1928de8a1cbbdff6ab454c1b8896ea81a3d8c0d08ff3ecea53ed75af1e47f5eecb0c9cbf8a2691066d6ffe66a76560234af9ac022
|
|
7
|
+
data.tar.gz: 3cc2551c4d6cdf13fce248f5b18991bdfd9c1c54cc39bfa4983e815898ddeb322da844880e469a760e094d47974357b11a9968ff8a99c2835f0db6c8945f18f2
|
data/README.md
CHANGED
|
@@ -85,12 +85,12 @@ BroHub.register :safe_bro,
|
|
|
85
85
|
|
|
86
86
|
```ruby
|
|
87
87
|
class SafeBro::ApplicationController < ::ApplicationController
|
|
88
|
-
include BroHub::
|
|
88
|
+
include BroHub::ControllerBase
|
|
89
89
|
bro_hub_section :safe_bro
|
|
90
90
|
end
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
`BroHub::Layout`
|
|
93
|
+
`BroHub::ControllerBase` includes `BroHub::Layout` (the layout, and `bro_hub_user`), turns on CSRF protection and opts out of the host app's Pundit `verify_authorized` checks, so every Bro controller behaves the same under any host `ApplicationController`. Override it if your gem has its own idea of who is signed in.
|
|
94
94
|
|
|
95
95
|
**3. Give your gem an installer** that sets up BroHub first, then itself. Name it `<section key>:install` so
|
|
96
96
|
`bro_hub:install` finds it:
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module BroHub
|
|
2
|
+
# Include in every Bro controller base (BroHub's own, and each gem's ApplicationController). It holds
|
|
3
|
+
# what must be right for *any* host app, so a clash with the host's ApplicationController is fixed once, here:
|
|
4
|
+
#
|
|
5
|
+
# class SafeBro::ApplicationController < SafeBro.config.parent_controller.constantize
|
|
6
|
+
# include BroHub::ControllerBase
|
|
7
|
+
# bro_hub_section :safe_bro
|
|
8
|
+
module ControllerBase
|
|
9
|
+
extend ActiveSupport::Concern
|
|
10
|
+
|
|
11
|
+
included do
|
|
12
|
+
include BroHub::Layout
|
|
13
|
+
|
|
14
|
+
protect_from_forgery with: :exception
|
|
15
|
+
|
|
16
|
+
# The host's Pundit checks (`after_action :verify_authorized`) don't apply: Bro controllers authorize
|
|
17
|
+
# people themselves and have no policy to ask. No-ops when Pundit isn't in use.
|
|
18
|
+
skip_after_action :verify_authorized, raise: false
|
|
19
|
+
skip_after_action :verify_policy_scoped, raise: false
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/lib/bro_hub/version.rb
CHANGED
data/lib/bro_hub.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bro_hub
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ruby Dev SRL
|
|
@@ -44,6 +44,7 @@ files:
|
|
|
44
44
|
- config/routes.rb
|
|
45
45
|
- lib/bro_hub.rb
|
|
46
46
|
- lib/bro_hub/configuration.rb
|
|
47
|
+
- lib/bro_hub/controller_base.rb
|
|
47
48
|
- lib/bro_hub/engine.rb
|
|
48
49
|
- lib/bro_hub/layout.rb
|
|
49
50
|
- lib/bro_hub/registry.rb
|