scim-kit 0.3.2 → 0.4.0

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: cd17a93f0e199bc2b7312d8643714ed2735724f911da7af62366e7b02f42fc5e
4
- data.tar.gz: 8bc20d24ddc2593667785155056b278a06c10f73a83c5d76d0c9b661c9acf73e
3
+ metadata.gz: a34f8dee8da1be1e6851d91b193a1d5ea0f2b14bddab9b36ee8141ea219abeaf
4
+ data.tar.gz: 3fe74aa226fc42b5188e5c5dc2699aeb3c8fb8d405829fd7eade63a92ca02953
5
5
  SHA512:
6
- metadata.gz: 6ecf2c8514298d164cfa844c52d3e706848e89d46b79b91e989476cedbd834097ed472e05b4f1c8bfa519acc8d46a416397bf414159d6ef97c73c7c26a0bb843
7
- data.tar.gz: f7bead86283182163aa08103d32f869c03e148f3186970a74d32d47aaf9780561b04a1bbd68e3a1b6743660dbcdd6d0d383ec3bd07f10b590c70680a4453f222
6
+ metadata.gz: a35746b0546fe4661e46fbb07958ee33a753744bc4041c74d4435c1df4c6778fac266266a0e727f8c5e40cacc5c3f5f783f875b22b5dd83966081557b34b1d2c
7
+ data.tar.gz: 0d4ccca792c5fcebab61eefda0a38e2ed2d47d6a43d9eb39b219f864a3f096de575670628ef0a15744357d22a7eb84f3b82518409933413f936002f7e2519d80
data/.gitignore CHANGED
@@ -9,5 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
- Gemfile.lock
13
12
  .byebug_history
data/.rubocop.yml CHANGED
@@ -9,7 +9,7 @@ AllCops:
9
9
  - 'vendor/**/*'
10
10
  TargetRubyVersion: 2.5
11
11
 
12
- Layout/IndentArray:
12
+ Layout/IndentFirstArrayElement:
13
13
  EnforcedStyle: consistent
14
14
 
15
15
  Metrics/BlockLength:
@@ -27,6 +27,9 @@ Naming/FileName:
27
27
  Exclude:
28
28
  - 'lib/scim-kit.rb'
29
29
 
30
+ Naming/RescuedExceptionsVariableName:
31
+ PreferredName: error
32
+
30
33
  RSpec/NamedSubject:
31
34
  Enabled: false
32
35
 
data/.travis.yml CHANGED
@@ -3,6 +3,6 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.5.3
7
- - 2.6.1
6
+ - 2.5.5
7
+ - 2.6.3
8
8
  before_install: gem install bundler -v 1.17.1
data/CHANGELOG.md CHANGED
@@ -1,4 +1,5 @@
1
- Version 0.3.2
1
+ Version 0.4.0
2
+
2
3
  # Changelog
3
4
  All notable changes to this project will be documented in this file.
4
5
 
@@ -6,7 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
7
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
8
 
8
9
  ## [Unreleased]
9
- - NA
10
+ - nil
11
+
12
+ ## [0.4.0] - 2019-06-15
13
+ - add implementation of SCIM 2.0 filter parser. [RFC-7644](https://tools.ietf.org/html/rfc7644#section-3.4.2.2)
10
14
 
11
15
  ## [0.3.2] - 2019-02-23
12
16
  ### Changed
@@ -35,7 +39,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
35
39
  - \_assign does not coerce values by default.
36
40
  - errors are merged together instead of overwritten during attribute validation.
37
41
 
38
- [Unreleased]: https://github.com/mokhan/scim-kit/compare/v0.3.2...HEAD
42
+ [Unreleased]: https://github.com/mokhan/scim-kit/compare/v0.4.0...HEAD
43
+ [0.4.0]: https://github.com/mokhan/scim-kit/compare/v0.3.2...v0.4.0
39
44
  [0.3.2]: https://github.com/mokhan/scim-kit/compare/v0.3.1...v0.3.2
40
45
  [0.3.1]: https://github.com/mokhan/scim-kit/compare/v0.3.0...v0.3.1
41
46
  [0.3.0]: https://github.com/mokhan/scim-kit/compare/v0.2.16...v0.3.0
data/Gemfile.lock ADDED
@@ -0,0 +1,102 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ scim-kit (0.4.0)
5
+ activemodel (>= 5.2.0)
6
+ net-hippie (~> 0.2)
7
+ parslet (~> 1.8)
8
+ tilt (~> 2.0)
9
+ tilt-jbuilder (~> 0.7)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ activemodel (5.2.3)
15
+ activesupport (= 5.2.3)
16
+ activesupport (5.2.3)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 0.7, < 2)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ addressable (2.6.0)
22
+ public_suffix (>= 2.0.2, < 4.0)
23
+ ast (2.4.0)
24
+ bundler-audit (0.6.1)
25
+ bundler (>= 1.2.0, < 3)
26
+ thor (~> 0.18)
27
+ byebug (11.0.1)
28
+ concurrent-ruby (1.1.5)
29
+ crack (0.4.3)
30
+ safe_yaml (~> 1.0.0)
31
+ diff-lcs (1.3)
32
+ ffaker (2.11.0)
33
+ hashdiff (0.4.0)
34
+ i18n (1.6.0)
35
+ concurrent-ruby (~> 1.0)
36
+ jaro_winkler (1.5.2)
37
+ jbuilder (2.9.1)
38
+ activesupport (>= 4.2.0)
39
+ minitest (5.11.3)
40
+ net-hippie (0.2.6)
41
+ parallel (1.17.0)
42
+ parser (2.6.3.0)
43
+ ast (~> 2.4.0)
44
+ parslet (1.8.2)
45
+ public_suffix (3.1.0)
46
+ rainbow (3.0.0)
47
+ rake (10.5.0)
48
+ rspec (3.8.0)
49
+ rspec-core (~> 3.8.0)
50
+ rspec-expectations (~> 3.8.0)
51
+ rspec-mocks (~> 3.8.0)
52
+ rspec-core (3.8.1)
53
+ rspec-support (~> 3.8.0)
54
+ rspec-expectations (3.8.4)
55
+ diff-lcs (>= 1.2.0, < 2.0)
56
+ rspec-support (~> 3.8.0)
57
+ rspec-mocks (3.8.1)
58
+ diff-lcs (>= 1.2.0, < 2.0)
59
+ rspec-support (~> 3.8.0)
60
+ rspec-support (3.8.2)
61
+ rubocop (0.71.0)
62
+ jaro_winkler (~> 1.5.1)
63
+ parallel (~> 1.10)
64
+ parser (>= 2.6)
65
+ rainbow (>= 2.2.2, < 4.0)
66
+ ruby-progressbar (~> 1.7)
67
+ unicode-display_width (>= 1.4.0, < 1.7)
68
+ rubocop-rspec (1.33.0)
69
+ rubocop (>= 0.60.0)
70
+ ruby-progressbar (1.10.1)
71
+ safe_yaml (1.0.5)
72
+ thor (0.20.3)
73
+ thread_safe (0.3.6)
74
+ tilt (2.0.9)
75
+ tilt-jbuilder (0.7.1)
76
+ jbuilder
77
+ tilt (>= 1.3.0, < 3)
78
+ tzinfo (1.2.5)
79
+ thread_safe (~> 0.1)
80
+ unicode-display_width (1.6.0)
81
+ webmock (3.6.0)
82
+ addressable (>= 2.3.6)
83
+ crack (>= 0.3.2)
84
+ hashdiff (>= 0.4.0, < 2.0.0)
85
+
86
+ PLATFORMS
87
+ ruby
88
+
89
+ DEPENDENCIES
90
+ bundler (~> 1.17)
91
+ bundler-audit (~> 0.6)
92
+ byebug
93
+ ffaker (~> 2.7)
94
+ rake (~> 10.0)
95
+ rspec (~> 3.0)
96
+ rubocop (~> 0.52)
97
+ rubocop-rspec (~> 1.22)
98
+ scim-kit!
99
+ webmock (~> 3.5)
100
+
101
+ BUNDLED WITH
102
+ 1.17.3
data/lib/scim/kit/v2.rb CHANGED
@@ -11,6 +11,7 @@ require 'scim/kit/v2/meta'
11
11
  require 'scim/kit/v2/mutability'
12
12
  require 'scim/kit/v2/resource'
13
13
  require 'scim/kit/v2/error'
14
+ require 'scim/kit/v2/filter'
14
15
  require 'scim/kit/v2/resource_type'
15
16
  require 'scim/kit/v2/returned'
16
17
  require 'scim/kit/v2/schema'
@@ -0,0 +1,131 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'parslet'
4
+
5
+ module Scim
6
+ module Kit
7
+ module V2
8
+ # Parses SCIM filter queries
9
+ class Filter < Parslet::Parser
10
+ root :filter
11
+
12
+ # FILTER = attrExp / logExp / valuePath / assignVariable / *1"not" "(" FILTER ")"
13
+ rule(:filter) do
14
+ logical_expression | filter_atom
15
+ end
16
+
17
+ rule(:filter_atom) do
18
+ (not_op? >> lparen >> filter >> rparen) | attribute_expression | value_path
19
+ end
20
+
21
+ # valuePath = attrPath "[" valFilter "]" ; FILTER uses sub-attributes of a parent attrPath
22
+ rule(:value_path) do
23
+ attribute_path >> lbracket >> value_filter >> rbracket
24
+ end
25
+
26
+ # valFilter = attrExp / logExp / *1"not" "(" valFilter ")"
27
+ rule(:value_filter) do
28
+ attribute_expression | logical_expression | not_op? >> lparen >> value_filter >> rparen
29
+ end
30
+
31
+ # attrExp = (attrPath SP "pr") / (attrPath SP compareOp SP compValue)
32
+ rule(:attribute_expression) do
33
+ (attribute_path >> space >> presence.as(:operator)) | (attribute_path >> space >> comparison_operator.as(:operator) >> space >> comparison_value.as(:value))
34
+ end
35
+
36
+ # logExp = FILTER SP ("and" / "or") SP FILTER
37
+ rule(:logical_expression) do
38
+ filter_atom.as(:left) >> space >> (and_op | or_op).as(:operator) >> space >> filter.as(:right)
39
+ end
40
+
41
+ # compValue = false / null / true / number / string ; rules from JSON (RFC 7159)
42
+ rule(:comparison_value) do
43
+ falsey | null | truthy | number | string
44
+ end
45
+
46
+ # compareOp = "eq" / "ne" / "co" / "sw" / "ew" / "gt" / "lt" / "ge" / "le"
47
+ rule(:comparison_operator) do
48
+ equal | not_equal | contains | starts_with | ends_with |
49
+ greater_than | less_than | less_than_equals | greater_than_equals
50
+ end
51
+
52
+ # attrPath = [URI ":"] ATTRNAME *1subAttr ; SCIM attribute name ; URI is SCIM "schema" URI
53
+ rule(:attribute_path) do
54
+ ((uri >> colon).repeat(0, 1) >> attribute_name >> sub_attribute.repeat(0, 1)).as(:attribute)
55
+ end
56
+
57
+ # ATTRNAME = ALPHA *(nameChar)
58
+ rule(:attribute_name) do
59
+ alpha >> name_character.repeat(0, nil)
60
+ end
61
+
62
+ # nameChar = "-" / "_" / DIGIT / ALPHA
63
+ rule(:name_character) { hyphen | underscore | digit | alpha }
64
+
65
+ # subAttr = "." ATTRNAME ; a sub-attribute of a complex attribute
66
+ rule(:sub_attribute) { dot >> attribute_name }
67
+
68
+ # uri = 1*ALPHA 1*(":" 1*ALPHA)
69
+ rule(:uri) do
70
+ # alpha.repeat(1, nil) >> (colon >> (alpha.repeat(1, nil) | version)).repeat(1, nil)
71
+ str('urn:ietf:params:scim:schemas:') >> (
72
+ str('core:2.0:User') |
73
+ str('core:2.0:Group') | (
74
+ str('extension') >>
75
+ colon >>
76
+ alpha.repeat(1) >>
77
+ colon >>
78
+ version >>
79
+ colon >>
80
+ alpha.repeat(1)
81
+ )
82
+ )
83
+ end
84
+
85
+ rule(:presence) { str('pr') }
86
+ rule(:and_op) { str('and') }
87
+ rule(:or_op) { str('or') }
88
+ rule(:not_op?) { (str('not') >> space).repeat(0, 1).as(:not) }
89
+ rule(:falsey) { str('false') }
90
+ rule(:truthy) { str('true') }
91
+ rule(:null) { str('null') }
92
+ rule(:number) do
93
+ str('-').maybe >> (
94
+ str('0') | (match('[1-9]') >> digit.repeat)
95
+ ) >> (
96
+ str('.') >> digit.repeat(1)
97
+ ).maybe >> (
98
+ match('[eE]') >> (str('+') | str('-')).maybe >> digit.repeat(1)
99
+ ).maybe
100
+ end
101
+ rule(:equal) { str('eq') }
102
+ rule(:not_equal) { str('ne') }
103
+ rule(:contains) { str('co') }
104
+ rule(:starts_with) { str('sw') }
105
+ rule(:ends_with) { str('ew') }
106
+ rule(:greater_than) { str('gt') }
107
+ rule(:less_than) { str('lt') }
108
+ rule(:greater_than_equals) { str('ge') }
109
+ rule(:less_than_equals) { str('le') }
110
+ rule(:string) do
111
+ quote >> (str('\\') >> any | str('"').absent? >> any).repeat >> quote
112
+ end
113
+ rule(:lparen) { str('(') }
114
+ rule(:rparen) { str(')') }
115
+ rule(:lbracket) { str('[') }
116
+ rule(:rbracket) { str(']') }
117
+ rule(:digit) { match('\d') }
118
+ rule(:quote) { str('"') }
119
+ rule(:single_quote) { str("'") }
120
+ rule(:space) { match('\s') }
121
+ rule(:alpha) { match['a-zA-Z'] }
122
+ rule(:dot) { str('.') }
123
+ rule(:colon) { str(':') }
124
+ rule(:hyphen) { str('-') }
125
+ rule(:underscore) { str('_') }
126
+ rule(:version) { digit >> dot >> digit }
127
+ rule(:assign) { str('=') }
128
+ end
129
+ end
130
+ end
131
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Scim
4
4
  module Kit
5
- VERSION = '0.3.2'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
data/scim-kit.gemspec CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
10
10
  spec.authors = ['mo']
11
11
  spec.email = ['mo@mokhan.ca']
12
12
 
13
- spec.summary = 'A SCIM library.'
14
- spec.description = 'A SCIM library.'
13
+ spec.summary = 'A simple toolkit for working with SCIM 2.0'
14
+ spec.description = 'A simple toolkit for working with SCIM 2.0'
15
15
  spec.homepage = 'https://www.github.com/mokhan/scim-kit'
16
16
  spec.license = 'MIT'
17
17
 
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  spec.add_dependency 'activemodel', '>= 5.2.0'
34
34
  spec.add_dependency 'net-hippie', '~> 0.2'
35
+ spec.add_dependency 'parslet', '~> 1.8'
35
36
  spec.add_dependency 'tilt', '~> 2.0'
36
37
  spec.add_dependency 'tilt-jbuilder', '~> 0.7'
37
38
  spec.add_development_dependency 'bundler', '~> 1.17'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scim-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-23 00:00:00.000000000 Z
11
+ date: 2019-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: parslet
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.8'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.8'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: tilt
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -192,7 +206,7 @@ dependencies:
192
206
  - - "~>"
193
207
  - !ruby/object:Gem::Version
194
208
  version: '3.5'
195
- description: A SCIM library.
209
+ description: A simple toolkit for working with SCIM 2.0
196
210
  email:
197
211
  - mo@mokhan.ca
198
212
  executables:
@@ -207,6 +221,7 @@ files:
207
221
  - ".travis.yml"
208
222
  - CHANGELOG.md
209
223
  - Gemfile
224
+ - Gemfile.lock
210
225
  - LICENSE.txt
211
226
  - README.md
212
227
  - Rakefile
@@ -229,6 +244,7 @@ files:
229
244
  - lib/scim/kit/v2/complex_attribute_validator.rb
230
245
  - lib/scim/kit/v2/configuration.rb
231
246
  - lib/scim/kit/v2/error.rb
247
+ - lib/scim/kit/v2/filter.rb
232
248
  - lib/scim/kit/v2/messages.rb
233
249
  - lib/scim/kit/v2/meta.rb
234
250
  - lib/scim/kit/v2/mutability.rb
@@ -273,8 +289,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
289
  - !ruby/object:Gem::Version
274
290
  version: '0'
275
291
  requirements: []
276
- rubygems_version: 3.0.2
292
+ rubygems_version: 3.0.3
277
293
  signing_key:
278
294
  specification_version: 4
279
- summary: A SCIM library.
295
+ summary: A simple toolkit for working with SCIM 2.0
280
296
  test_files: []