Commit 6f9c729
Changed files (8)
app
controllers
models
scim
config
locales
app/controllers/scim/v2/resource_types_controller.rb
@@ -12,6 +12,7 @@ module Scim
def show
current_resource = resource_types[params[:id]]
raise ActiveRecord::RecordNotFound unless current_resource
+
render status: :ok, json: current_resource.to_json
end
app/controllers/scim/v2/schemas_controller.rb
@@ -12,6 +12,7 @@ module Scim
def show
current_schema = schemas[params[:id]]
raise ActiveRecord::RecordNotFound unless current_schema
+
render json: current_schema.to_json
end
app/controllers/registrations_controller.rb
@@ -10,8 +10,8 @@ class RegistrationsController < ApplicationController
def create
User.create!(user_params)
redirect_to new_session_path
- rescue ActiveRecord::RecordInvalid => invalid
- redirect_to new_registration_path, error: invalid.record.errors
+ rescue ActiveRecord::RecordInvalid => error
+ redirect_to new_registration_path, error: error.record.errors
end
private
app/models/scim/user.rb
@@ -26,7 +26,11 @@ module SCIM
private
def must_be_user_schema
- errors.add(:schemas, "is invalid") unless schemas == [Scim::Kit::V2::Schemas::USER]
+ errors.add(:schemas, :invalid) unless user_schema?
+ end
+
+ def user_schema?
+ schemas == [Scim::Kit::V2::Schemas::USER]
end
def ensure_password_update_is_allowed!(user)
app/models/scim/user_mapper.rb
@@ -8,7 +8,10 @@ module SCIM
def map_from(user)
schema = Scim::Kit::V2.configuration.schemas[Scim::Kit::V2::Schemas::USER]
- Scim::Kit::V2::Resource.new(schemas: [schema], location: @url_helpers.scim_v2_user_url(user)) do |x|
+ Scim::Kit::V2::Resource.new(
+ schemas: [schema],
+ location: @url_helpers.scim_v2_user_url(user)
+ ) do |x|
x.meta.version = user.lock_version
x.meta.created = user.created_at
x.meta.last_modified = user.updated_at
config/locales/en.yml
@@ -9,7 +9,7 @@ en:
userName: userName
errors:
messages:
- record_invalid: "Invalid"
+ record_invalid: Invalid
activerecord:
attributes:
user:
.rubocop.yml
@@ -15,7 +15,7 @@ AllCops:
- 'tmp/**/*'
- 'vendor/**/*'
-Layout/IndentArray:
+Layout/IndentFirstArrayElement:
EnforcedStyle: consistent
Metrics/AbcSize:
@@ -40,6 +40,9 @@ Metrics/ParameterLists:
Metrics/PerceivedComplexity:
Enabled: false
+Naming/RescuedExceptionsVariableName:
+ PreferredName: error
+
RSpec/DescribeClass:
Enabled: false
Gemfile.lock
@@ -1,49 +1,49 @@
GEM
remote: https://rubygems.org/
specs:
- actioncable (5.2.2)
- actionpack (= 5.2.2)
+ actioncable (5.2.3)
+ actionpack (= 5.2.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
- actionmailer (5.2.2)
- actionpack (= 5.2.2)
- actionview (= 5.2.2)
- activejob (= 5.2.2)
+ actionmailer (5.2.3)
+ actionpack (= 5.2.3)
+ actionview (= 5.2.3)
+ activejob (= 5.2.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
- actionpack (5.2.2)
- actionview (= 5.2.2)
- activesupport (= 5.2.2)
+ actionpack (5.2.3)
+ actionview (= 5.2.3)
+ activesupport (= 5.2.3)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
- actionview (5.2.2)
- activesupport (= 5.2.2)
+ actionview (5.2.3)
+ activesupport (= 5.2.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
- activejob (5.2.2)
- activesupport (= 5.2.2)
+ activejob (5.2.3)
+ activesupport (= 5.2.3)
globalid (>= 0.3.6)
- activemodel (5.2.2)
- activesupport (= 5.2.2)
- activerecord (5.2.2)
- activemodel (= 5.2.2)
- activesupport (= 5.2.2)
+ activemodel (5.2.3)
+ activesupport (= 5.2.3)
+ activerecord (5.2.3)
+ activemodel (= 5.2.3)
+ activesupport (= 5.2.3)
arel (>= 9.0)
- activerecord-session_store (1.1.1)
+ activerecord-session_store (1.1.3)
actionpack (>= 4.0)
activerecord (>= 4.0)
multi_json (~> 1.11, >= 1.11.2)
rack (>= 1.5.2, < 3)
railties (>= 4.0)
- activestorage (5.2.2)
- actionpack (= 5.2.2)
- activerecord (= 5.2.2)
+ activestorage (5.2.3)
+ actionpack (= 5.2.3)
+ activerecord (= 5.2.3)
marcel (~> 0.3.1)
- activesupport (5.2.2)
+ activesupport (5.2.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
@@ -55,7 +55,7 @@ GEM
audited (4.8.0)
activerecord (>= 4.0, < 5.3)
bcrypt (3.1.12)
- better_html (1.0.11)
+ better_html (1.0.13)
actionview (>= 4.0)
activesupport (>= 4.0)
ast (~> 2.0)
@@ -63,17 +63,17 @@ GEM
html_tokenizer (~> 0.0.6)
parser (>= 2.4)
smart_properties
- bindex (0.5.0)
- bootsnap (1.3.2)
+ bindex (0.7.0)
+ bootsnap (1.4.4)
msgpack (~> 1.0)
- brakeman (4.4.0)
+ brakeman (4.5.0)
browser (2.5.3)
builder (3.2.3)
bundler-audit (0.6.1)
bundler (>= 1.2.0, < 3)
thor (~> 0.18)
- byebug (10.0.2)
- capybara (3.13.2)
+ byebug (11.0.1)
+ capybara (3.18.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
@@ -84,15 +84,15 @@ GEM
capybara-screenshot (1.0.22)
capybara (>= 1.0, < 4)
launchy
- childprocess (0.9.0)
- ffi (~> 1.0, >= 1.0.11)
+ childprocess (1.0.1)
+ rake (< 13.0)
colorator (1.1.0)
- concurrent-ruby (1.1.4)
+ concurrent-ruby (1.1.5)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.4)
diff-lcs (1.3)
- dotenv (2.6.0)
+ dotenv (2.7.2)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
@@ -112,23 +112,23 @@ GEM
factory_bot_rails (4.11.1)
factory_bot (~> 4.11.1)
railties (>= 3.0.0)
- ffaker (2.10.0)
+ ffaker (2.11.0)
ffi (1.10.0)
- flipper (0.16.0)
- flipper-active_record (0.16.0)
+ flipper (0.16.2)
+ flipper-active_record (0.16.2)
activerecord (>= 3.2, < 6)
- flipper (~> 0.16.0)
+ flipper (~> 0.16.2)
flutie (2.1.0)
forwardable-extended (2.6.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
- hashdiff (0.3.8)
- highline (2.0.1)
+ hashdiff (0.3.9)
+ highline (2.0.2)
html_tokenizer (0.0.7)
http_parser.rb (0.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
- i18n-tasks (0.9.28)
+ i18n-tasks (0.9.29)
activesupport (>= 4.0.2)
ast (>= 2.1.0)
erubi
@@ -155,19 +155,19 @@ GEM
pathutil (~> 0.9)
rouge (>= 1.7, < 4)
safe_yaml (~> 1.0)
- jekyll-feed (0.11.0)
- jekyll (~> 3.3)
+ jekyll-feed (0.12.1)
+ jekyll (>= 3.7, < 5.0)
jekyll-sass-converter (1.5.2)
sass (~> 3.4)
- jekyll-seo-tag (2.5.0)
+ jekyll-seo-tag (2.6.0)
jekyll (~> 3.3)
- jekyll-watch (2.1.2)
+ jekyll-watch (2.2.1)
listen (~> 3.0)
jwt (2.1.0)
kramdown (1.17.0)
launchy (2.4.3)
addressable (~> 2.3)
- liquid (4.0.1)
+ liquid (4.0.3)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
@@ -190,38 +190,37 @@ GEM
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.11.3)
- msgpack (1.2.6)
+ msgpack (1.2.10)
multi_json (1.13.1)
- net-hippie (0.2.1)
+ net-hippie (0.2.6)
nio4r (2.3.1)
- nokogiri (1.10.1)
+ nokogiri (1.10.3)
mini_portile2 (~> 2.4.0)
- parallel (1.13.0)
- parser (2.6.0.0)
+ parallel (1.17.0)
+ parser (2.6.3.0)
ast (~> 2.4.0)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
pg (1.1.4)
- powerpack (0.1.2)
public_suffix (3.0.3)
- puma (3.12.0)
- rack (2.0.6)
+ puma (3.12.1)
+ rack (2.0.7)
rack-proxy (0.6.5)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
- rails (5.2.2)
- actioncable (= 5.2.2)
- actionmailer (= 5.2.2)
- actionpack (= 5.2.2)
- actionview (= 5.2.2)
- activejob (= 5.2.2)
- activemodel (= 5.2.2)
- activerecord (= 5.2.2)
- activestorage (= 5.2.2)
- activesupport (= 5.2.2)
+ rails (5.2.3)
+ actioncable (= 5.2.3)
+ actionmailer (= 5.2.3)
+ actionpack (= 5.2.3)
+ actionview (= 5.2.3)
+ activejob (= 5.2.3)
+ activemodel (= 5.2.3)
+ activerecord (= 5.2.3)
+ activestorage (= 5.2.3)
+ activesupport (= 5.2.3)
bundler (>= 1.3.0)
- railties (= 5.2.2)
+ railties (= 5.2.3)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
@@ -236,9 +235,9 @@ GEM
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
- railties (5.2.2)
- actionpack (= 5.2.2)
- activesupport (= 5.2.2)
+ railties (5.2.3)
+ actionpack (= 5.2.3)
+ activesupport (= 5.2.3)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
@@ -247,12 +246,12 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
- regexp_parser (1.3.0)
+ regexp_parser (1.4.0)
rotp (3.3.1)
rouge (3.3.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
- rspec-expectations (3.8.2)
+ rspec-expectations (3.8.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
@@ -267,35 +266,35 @@ GEM
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
- rubocop (0.63.1)
+ rubocop (0.68.1)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
- powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
- unicode-display_width (~> 1.4.0)
+ unicode-display_width (>= 1.4.0, < 1.6)
rubocop-rspec (1.32.0)
rubocop (>= 0.60.0)
ruby-progressbar (1.10.0)
ruby_dep (1.5.0)
rubyzip (1.2.2)
- safe_yaml (1.0.4)
- saml-kit (1.0.29)
+ safe_yaml (1.0.5)
+ saml-kit (1.1.0)
activemodel (>= 4.2.0)
net-hippie (~> 0.1)
- xml-kit (~> 0.2)
- sass (3.7.3)
+ xml-kit (>= 0.3.0, < 1.0.0)
+ sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
- scim-kit (0.2.15)
+ scim-kit (0.3.2)
activemodel (>= 5.2.0)
+ net-hippie (~> 0.2)
tilt (~> 2.0)
tilt-jbuilder (~> 0.7)
- selenium-webdriver (3.141.0)
- childprocess (~> 0.5)
+ selenium-webdriver (3.142.1)
+ childprocess (>= 0.5, < 2.0)
rubyzip (~> 1.2, >= 1.2.2)
smart_properties (1.13.1)
spank (1.0.1441140881)
@@ -319,7 +318,7 @@ GEM
turbolinks-source (5.2.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
- unicode-display_width (1.4.1)
+ unicode-display_width (1.5.0)
vcr (4.0.0)
web-console (3.7.0)
actionview (>= 5.0)
@@ -330,17 +329,17 @@ GEM
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
- webpacker (3.5.5)
+ webpacker (3.6.0)
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
- xml-kit (0.3.0)
+ xml-kit (0.4.0)
activemodel (>= 4.2.0)
builder (~> 3.2)
- nokogiri (>= 1.8.5)
+ nokogiri (~> 1.10)
tilt (>= 1.4.1)
xmldsig (~> 0.6)
xmldsig (0.6.6)
@@ -396,7 +395,7 @@ DEPENDENCIES
webpacker (~> 3.5)
RUBY VERSION
- ruby 2.6.0p0
+ ruby 2.6.1p33
BUNDLED WITH
1.17.3