sinaliza 0.2.0 → 0.2.1
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 +18 -2
- data/lib/sinaliza/version.rb +1 -1
- 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: 6c2618a6a40d81712da0524d8a74a96abc8632b4c6012644e7c903fa96f23e5e
|
|
4
|
+
data.tar.gz: 798a819da36cb69f47e8555f27b8f16663b27518e2aaec4f7549670967cc165e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5489aed570c83a2522cd8a057c5e343f42c0eb18e42acd455ec245792f842af647ba42572e05a4418bd9fdcab658c712e856b1ffa829a47066ada5ce080951f1
|
|
7
|
+
data.tar.gz: de339af08744a9525e67c68d6e8311e360b4a85719345bdbd5c8fe3c40a216c17e55149a116d95ef5d8a75bd07e8bdcbffafb36534b6dd60f66cca692b97daa9
|
data/README.md
CHANGED
|
@@ -188,15 +188,31 @@ The engine mounts a monitor dashboard at your chosen path. It provides:
|
|
|
188
188
|
|
|
189
189
|
### Protecting the dashboard
|
|
190
190
|
|
|
191
|
-
The gem does not include authentication. Protect access via route constraints in your host app
|
|
191
|
+
The gem does not include authentication. Protect access via route constraints in your host app.
|
|
192
|
+
|
|
193
|
+
**With Devise:**
|
|
192
194
|
|
|
193
195
|
```ruby
|
|
194
196
|
# config/routes.rb
|
|
195
197
|
authenticate :user, ->(u) { u.admin? } do
|
|
196
198
|
mount Sinaliza::Engine => "/sinaliza"
|
|
197
199
|
end
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Without Devise:**
|
|
203
|
+
|
|
204
|
+
```ruby
|
|
205
|
+
# app/constraints/admin_constraint.rb
|
|
206
|
+
class AdminConstraint
|
|
207
|
+
def matches?(request)
|
|
208
|
+
user_id = request.session[:user_id]
|
|
209
|
+
return false unless user_id
|
|
198
210
|
|
|
199
|
-
|
|
211
|
+
User.find_by(id: user_id)&.admin?
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# config/routes.rb
|
|
200
216
|
mount Sinaliza::Engine => "/sinaliza", constraints: AdminConstraint.new
|
|
201
217
|
```
|
|
202
218
|
|
data/lib/sinaliza/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sinaliza
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marcelo Moraes
|
|
@@ -72,6 +72,7 @@ metadata:
|
|
|
72
72
|
homepage_uri: https://github.com/marcelonmoraes/sinaliza
|
|
73
73
|
source_code_uri: https://github.com/marcelonmoraes/sinaliza/tree/main
|
|
74
74
|
changelog_uri: https://github.com/marcelonmoraes/sinaliza/blob/main/CHANGELOG.md
|
|
75
|
+
documentation_uri: https://marcelonmoraes.github.io/sinaliza/
|
|
75
76
|
rdoc_options: []
|
|
76
77
|
require_paths:
|
|
77
78
|
- lib
|