ronflex 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21aabb761af1c65b239d05c75a99670af07abfbe160fb9d1a8e56b02a2313ca9
4
- data.tar.gz: 7680cc20371a45f73c199e3cd2ac762e135ea46cfc705b5e2059fa9bf0097c9f
3
+ metadata.gz: e07dc7d221a3d851d0b547183578aa2f8eb5d6de29362e0c9561074c67b01229
4
+ data.tar.gz: bb9f4b8d37d4cd95c2d80a0a16b920826fa67fe47ebd18064bcd17764f930373
5
5
  SHA512:
6
- metadata.gz: bb6dfe2898b6b7ea6b640d722f2b3aaed680de1996515891e0f71aa234dffcd1b584d54b36c88847ecc3d73092b0c496530622e3a54a32ffe90f07323d0f29fc
7
- data.tar.gz: 33a0649749402508b1c263fdd6c6fa97bd91f4d513e477e8e59e9933e2d1983b004d03a1c300de95eb6903d0e621dcc18ed8dde1f442fece0109be6dba1a4dfa
6
+ metadata.gz: 0cf22dc9e37c2aedcb4628fe2e958a691d192f46272b6e34697d028bb6deecefaf16465edeebf4c6eab73f7ffdaa6535db418a88905c6853c3289e6ed4638190
7
+ data.tar.gz: 477915e2dae95542a00c61bba7142385b3d989d6bdddfb7193ed8a3486c54274efe24c8215970d6907db22ebd5b2976756ab7afd170ecc2636a3281e99531d94
data/CHANGELOG.md CHANGED
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## [0.1.3] - 2024-12-01
4
+ ### Added
5
+ - "/favicon.ico" add to excluded_paths by default
6
+ ### Changed
7
+ ### Fixed
8
+ - "Authorized access if provider is defined and not return nil with empty rules"
data/README.md CHANGED
@@ -8,18 +8,18 @@
8
8
 
9
9
  Run:
10
10
 
11
- bundle add zarby
11
+ bundle add ronflex
12
12
 
13
13
  Or install it yourself as:
14
14
 
15
- $ gem install zarby
15
+ $ gem install ronflex
16
16
 
17
17
  ## Configuration
18
18
 
19
19
  ```ruby
20
20
  Ronflex.configure do |config|
21
- # The list of paths that are always accessible (no restrictions)
22
- config.excluded_path = ["/health_check", "/status"]
21
+ # The list of paths that are always accessible by default "/health_check" and "/favicon.ico"(no restrictions)
22
+ config.excluded_path += ["/status"]
23
23
 
24
24
  # Define a provider for user model (can be a Proc or Lambda)
25
25
  config.provider = ->(env) { User.find_by(api_key: env['HTTP_API_KEY']) }
@@ -37,7 +37,7 @@ module Ronflex
37
37
  # These paths are ignored by the defined rules.
38
38
  #
39
39
  # @return [Array<String>]
40
- DEFAULT_EXCLUDED_PATHS = ["/health_check"]
40
+ DEFAULT_EXCLUDED_PATHS = ["/health_check", "/favicon.ico"]
41
41
  # Default provider.
42
42
  # by default, it is a lambda which returns `nil`.
43
43
  #
@@ -111,7 +111,7 @@ module Ronflex
111
111
  # request = OpenStruct.new(path: "/admin/dashboard")
112
112
  # config.allowed?(model, request) # => true or false
113
113
  def allowed?(model, request)
114
- rules.any? { |rule| rule.matches?(model, request) }
114
+ rules.empty? || rules.any? { |rule| rule.matches?(model, request) }
115
115
  end
116
116
 
117
117
 
data/lib/ronflex/rule.rb CHANGED
@@ -40,7 +40,7 @@ module Ronflex
40
40
  # @param request [Object] The request to check (e.g., an HTTP request object).
41
41
  # @return [Boolean] `true` if the model matches the rule's type and satisfies the block's logic, `false` otherwise.
42
42
  def matches?(model, request)
43
- model == type && rule.call(model, request)
43
+ rule.call(model, request)
44
44
  end
45
45
  end
46
46
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ronflex
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
data/lib/ronflex.rb CHANGED
@@ -6,18 +6,17 @@ require "ronflex/rest"
6
6
 
7
7
  module Ronflex
8
8
  class << self
9
- # Method to configure `Snorlax` with a block
9
+ # Method to configure `Ronflex` with a block
10
10
  #
11
- # @yield [config] The block receives an instance of `Snorlax::Configuration`
12
- # @yieldparam config [Snorlax::Configuration] The configuration object to modify.
11
+ # @yield [config] The block receives an instance of `Ronflex::Configuration`
12
+ # @yieldparam config [Ronflex::Configuration] The configuration object to modify.
13
13
  def configure
14
- @configuration ||= Configuration.new
15
14
  yield @configuration if block_given?
16
15
  end
17
16
 
18
17
  # Accesses global configuration
19
18
  #
20
- # @return [Snorlax::Configuration] The global instance of the configuration
19
+ # @return [Ronflex::Configuration] The global instance of the configuration
21
20
  def configuration
22
21
  @configuration ||= Configuration.new
23
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronflex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - vianney.sonneville