scimitar 1.10.0 → 1.11.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: db2ddb3c77cd7a482505003624275950458638efef053abe9df427b644412de4
4
- data.tar.gz: f2bc178baf10fd8cfc995114ae7dad80f822a604f9b016ae0f16cea5e1abbc9f
3
+ metadata.gz: 5860adcfd6c793922be88ef8bb7bb878571e8fcd34ea89ead9d0278f09582cff
4
+ data.tar.gz: 2f7bf25e40156c0f006255c0c015f6302c8de39fc1634be789dba462d43f8c4a
5
5
  SHA512:
6
- metadata.gz: 945f6073d1fa337eab6ef82644402a7c977858db3289af7480970fadd047c4ef6a55ed8f6d2756265a84c794ca957f1c83d83ecbad07d999355c23dd0cf2cbfa
7
- data.tar.gz: '0869c64c2c49128005a7163814a3ccb32e0c99209ad2a867b4c24a87c9b95e8bbb7cb39fc92bdec5c01a9d45c4316ea25c33ed3fd347e500bea02fe62922df2a'
6
+ metadata.gz: 8047867c9365db25571693526e765d1a1a6b6d9cd17278f4bca2037815b5f9e0b9945390cc5ffba0228b9fabd3b15deae253519bbbe74ada2c262718d1c54989
7
+ data.tar.gz: 6ef777d96c932404c1ae0209804010fee98e993ce289d4eac09e0c8c3395b0de390fb423611d599fb6750a5d46e34545e0685e9563441fcc2d582fb5b6d1618f
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 RIPA Global
3
+ Copyright (c) 2024 RIPA Global
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -321,7 +321,7 @@ end
321
321
 
322
322
  #### Other source types
323
323
 
324
- If you do _not_ use ActiveRecord to store data, or if you have very esoteric read-write requirements, you can subclass [`Scimigar::ResourcesController`](https://www.rubydoc.info/gems/scimitar/Scimitar/ResourcesController) in a manner similar to this:
324
+ If you do _not_ use ActiveRecord to store data, or if you have very esoteric read-write requirements, you can subclass [`Scimitar::ResourcesController`](https://www.rubydoc.info/gems/scimitar/Scimitar/ResourcesController) in a manner similar to this:
325
325
 
326
326
  ```ruby
327
327
  class UsersController < Scimitar::ResourcesController
@@ -594,7 +594,7 @@ By default, Scimitar advertises (via things like [the `/Schemas` endpoint](https
594
594
 
595
595
  ```ruby
596
596
  Rails.application.config.to_prepare do
597
- Scimitar::Engine::set_default_resources([Scimitar::Resources::User])
597
+ Scimitar::Engine.set_default_resources([Scimitar::Resources::User])
598
598
  # ...other Scimitar configuration / initialisation code...
599
599
  end
600
600
  ```
@@ -9,10 +9,6 @@ module Scimitar
9
9
  before_action :add_mandatory_response_headers
10
10
  before_action :authenticate
11
11
 
12
- if Scimitar.engine_configuration.application_controller_mixin
13
- include Scimitar.engine_configuration.application_controller_mixin
14
- end
15
-
16
12
  # =========================================================================
17
13
  # PROTECTED INSTANCE METHODS
18
14
  # =========================================================================
@@ -153,5 +149,8 @@ module Scimitar
153
149
  return result
154
150
  end
155
151
 
152
+ if Scimitar.engine_configuration.application_controller_mixin
153
+ include Scimitar.engine_configuration.application_controller_mixin
154
+ end
156
155
  end
157
156
  end
@@ -5,7 +5,13 @@ module Scimitar
5
5
  resource.resource_type(scim_resource_type_url(name: resource.resource_type_id))
6
6
  end
7
7
 
8
- render json: resource_types
8
+ render json: {
9
+ schemas: [
10
+ 'urn:ietf:params:scim:api:messages:2.0:ListResponse'
11
+ ],
12
+ totalResults: resource_types.size,
13
+ Resources: resource_types
14
+ }
9
15
  end
10
16
 
11
17
  def show
@@ -88,9 +88,9 @@ module Scimitar
88
88
  unrecognised_resources = resource_array - @standard_default_resources
89
89
 
90
90
  if unrecognised_resources.any?
91
- raise "Scimitar::Engine::set_default_resources: Only #{@standard_default_resources.map(&:name).join(', ')} are supported"
91
+ raise "Scimitar::Engine.set_default_resources: Only #{@standard_default_resources.map(&:name).join(', ')} are supported"
92
92
  elsif resource_array.empty?
93
- raise 'Scimitar::Engine::set_default_resources: At least one resource must be given'
93
+ raise 'Scimitar::Engine.set_default_resources: At least one resource must be given'
94
94
  end
95
95
 
96
96
  @default_resources = resource_array
@@ -3,11 +3,11 @@ module Scimitar
3
3
  # Gem version. If this changes, be sure to re-run "bundle install" or
4
4
  # "bundle update".
5
5
  #
6
- VERSION = '1.10.0'
6
+ VERSION = '1.11.0'
7
7
 
8
8
  # Date for VERSION. If this changes, be sure to re-run "bundle install"
9
9
  # or "bundle update".
10
10
  #
11
- DATE = '2024-06-27'
11
+ DATE = '2024-10-22'
12
12
 
13
13
  end
@@ -9,11 +9,15 @@ RSpec.describe Scimitar::ResourceTypesController do
9
9
  it 'renders the resource type for user' do
10
10
  get :index, format: :scim
11
11
  response_hash = JSON.parse(response.body)
12
- expected_response = [ Scimitar::Resources::User.resource_type(scim_resource_type_url(name: 'User', test: 1)),
13
- Scimitar::Resources::Group.resource_type(scim_resource_type_url(name: 'Group', test: 1))
14
- ].to_json
12
+ expected_response = {
13
+ schemas: ['urn:ietf:params:scim:api:messages:2.0:ListResponse'],
14
+ totalResults: 2,
15
+ Resources: [
16
+ Scimitar::Resources::User.resource_type(scim_resource_type_url(name: 'User', test: 1)),
17
+ Scimitar::Resources::Group.resource_type(scim_resource_type_url(name: 'Group', test: 1))
18
+ ]
19
+ }.to_json
15
20
 
16
- response_hash = JSON.parse(response.body)
17
21
  expect(response_hash).to eql(JSON.parse(expected_response))
18
22
  end
19
23
 
@@ -78,26 +78,26 @@ RSpec.describe Scimitar::Engine do
78
78
  end
79
79
 
80
80
  it 'notes changes to defaults' do
81
- Scimitar::Engine::set_default_resources([Scimitar::Resources::User])
81
+ Scimitar::Engine.set_default_resources([Scimitar::Resources::User])
82
82
  expect(Scimitar::Engine.resources()).to match_array([Scimitar::Resources::User])
83
83
  end
84
84
 
85
85
  it 'notes changes to defaults with custom resources added' do
86
- Scimitar::Engine::set_default_resources([Scimitar::Resources::User])
86
+ Scimitar::Engine.set_default_resources([Scimitar::Resources::User])
87
87
  Scimitar::Engine.add_custom_resource(@license_resource)
88
88
  expect(Scimitar::Engine.resources()).to match_array([Scimitar::Resources::User, @license_resource])
89
89
  end
90
90
 
91
91
  it 'rejects bad defaults' do
92
92
  expect {
93
- Scimitar::Engine::set_default_resources([@license_resource])
94
- }.to raise_error('Scimitar::Engine::set_default_resources: Only Scimitar::Resources::User, Scimitar::Resources::Group are supported')
93
+ Scimitar::Engine.set_default_resources([@license_resource])
94
+ }.to raise_error('Scimitar::Engine.set_default_resources: Only Scimitar::Resources::User, Scimitar::Resources::Group are supported')
95
95
  end
96
96
 
97
97
  it 'rejects empty defaults' do
98
98
  expect {
99
- Scimitar::Engine::set_default_resources([])
100
- }.to raise_error('Scimitar::Engine::set_default_resources: At least one resource must be given')
99
+ Scimitar::Engine.set_default_resources([])
100
+ }.to raise_error('Scimitar::Engine.set_default_resources: At least one resource must be given')
101
101
  end
102
102
  end # "context '::resources, :add_custom_resource, ::set_default_resources' do"
103
103
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scimitar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RIPA Global
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-06-27 00:00:00.000000000 Z
12
+ date: 2024-10-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -267,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
267
  - !ruby/object:Gem::Version
268
268
  version: '0'
269
269
  requirements: []
270
- rubygems_version: 3.5.4
270
+ rubygems_version: 3.5.16
271
271
  signing_key:
272
272
  specification_version: 4
273
273
  summary: SCIM v2 for Rails