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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -2
  3. data/lib/sinaliza/version.rb +1 -1
  4. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc89fcab6f596adbd552ed8b28da09bba68fc38afc1d784855ebe95361b077ce
4
- data.tar.gz: eb6b974f6c9701a96b8aca56364e562ace77804aa939c87e5ca808a26efbe7e9
3
+ metadata.gz: 6c2618a6a40d81712da0524d8a74a96abc8632b4c6012644e7c903fa96f23e5e
4
+ data.tar.gz: 798a819da36cb69f47e8555f27b8f16663b27518e2aaec4f7549670967cc165e
5
5
  SHA512:
6
- metadata.gz: 1d60d7c5c5d669fb061882336df233956bea2fed3517e6a9e95756f27e0e70103e3601f743e27b3e41f85c9b281b6ee26d5ca2ee6fb9482bf52a4a2c278d9f39
7
- data.tar.gz: 7b40ff04f632e503bc099a8cb68c9e75dbdde24680085fa65d882cc2767e7d6426ab8ec07dfec667fa3b65e03f28314a3df0c69ebde6a0cdd4b0fb79e24c3d50
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
- # or with a simple constraint
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
 
@@ -1,3 +1,3 @@
1
1
  module Sinaliza
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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.0
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