u-authorization 1.2.0 → 1.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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/authorization.rb +5 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f562f7c1da45026cc68c44e36fc1e60b029d4b16bc4e433c33e772653379c47b
4
- data.tar.gz: 16bc62864439ae91aa54adc79fcdb898b29bd79aeffef171a002aaca3f95a85c
3
+ metadata.gz: 7ec8f1983839a46911cc985c1d3a27fd56ac71d53135aec13025071ccde2af5a
4
+ data.tar.gz: cf196505dea37701820b8a0a85d46b34c3091d556a622de4899f605ad8d30c22
5
5
  SHA512:
6
- metadata.gz: 9115178e4d98dd710bee877720c711533c7aa046b6b70cd96b4463809d703f9dc28f55456e48321130438edde094b9d10245a0c46fa43890e2af879cd8c096a0
7
- data.tar.gz: ef15b3487d9a8cf7ff3108a7078246d27406bfc82eb8d487779e6d1432146da066a54cb39c991559954d423a6494303b2becdee3494ade7a031f58b409395dea
6
+ metadata.gz: a872b99a0300a3742e383895bbefe4bb51d7d94599280ea2a8c0670d89bcab7e5a8c9ebb8b537a4e5b5c58795103f7a82289c6cc8160273f65ada32dfd14029f
7
+ data.tar.gz: 5819bc7367619be3a9032540848592aac4c2dd283f918df538fabd061986c0b89534916159d09a7edcd38a65a01ae9cf147fb66f8792d841440560b439d9cecd
data/authorization.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Authorization
4
- VERSION = '1.2.0'
4
+ VERSION = '1.2.1'
5
5
 
6
6
  MapValuesAsDowncasedStrings = -> (values) do
7
7
  Array(values).map { |value| String(value).downcase }
@@ -23,17 +23,17 @@ module Authorization
23
23
  if !(any = role_permission['any']).nil?
24
24
  any
25
25
  elsif only = role_permission['only']
26
- check_feature_permission(only) { |perm| context.include?(perm) }
26
+ check_feature_permission(only, context)
27
27
  elsif except = role_permission['except']
28
- check_feature_permission(except) { |perm| !context.include?(perm) }
28
+ !check_feature_permission(except, context)
29
29
  else
30
30
  raise NotImplementedError
31
31
  end
32
32
  end
33
33
 
34
- def check_feature_permission(context_values)
34
+ def check_feature_permission(context_values, context)
35
35
  MapValuesAsDowncasedStrings.(context_values).any? do |context_value|
36
- Array(context_value.split('.')).all? { |permission| yield(permission) }
36
+ Array(context_value.split('.')).all? { |permission| context.include?(permission) }
37
37
  end
38
38
  end
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: u-authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Serradura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-10 00:00:00.000000000 Z
11
+ date: 2018-11-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Simple authorization library and role managment for Ruby.
14
14
  email: rodrigo.serradura@gmail.com