Commit ec8a2f1
Changed files (6)
app
controllers
scim
helpers
models
views
scim
v2
app/controllers/scim/v2/schemas_controller.rb
@@ -9,7 +9,9 @@ module Scim
end
def show
- render partial: 'schema', formats: :scim, status: :ok, locals: { schema: current_schema }
+ render partial: 'schema', formats: :scim, status: :ok, locals: {
+ schema: current_schema
+ }
end
private
app/controllers/scim/controller.rb
@@ -45,7 +45,9 @@ module Scim
end
def ensure_correct_content_type!
- render 'unsupported_media_type', status: :unsupported_media_type, formats: :scim unless acceptable_content_type?
+ return if acceptable_content_type?
+ status = :unsupported_media_type
+ render 'unsupported_media_type', status: status, formats: :scim
end
def acceptable_content_type?
app/helpers/application_helper.rb
@@ -31,7 +31,10 @@ module ApplicationHelper
case error
when ActiveRecord::RecordInvalid
errors = error.record.errors.full_messages
- return 'uniqueness' if errors.count == 1 && errors[0].end_with?('has already been taken')
+ if errors.count == 1 &&
+ errors[0].end_with?('has already been taken')
+ return 'uniqueness'
+ end
end
"invalidValue"
end
app/models/user.rb
@@ -2,7 +2,9 @@
class User < ApplicationRecord
has_secure_password
- validates :email, presence: true, email: true, uniqueness: true
+ validates :email, presence: true, email: true, uniqueness: {
+ case_sensitive: false
+ }
after_initialize do
self.uuid = SecureRandom.uuid unless uuid
app/views/scim/v2/schemas/_group.scim.jbuilder
@@ -12,7 +12,7 @@ json.attributes [
"name": "displayName",
"type": "string",
"multiValued": false,
- "description": "A human-readable name for the Group. REQUIRED.",
+ "description": "A human-readable name for the Group.",
"required": false,
"caseExact": false,
"mutability": "readWrite",
@@ -45,7 +45,7 @@ json.attributes [
Group
],
"multiValued": false,
- "description": "The URI corresponding to a SCIM resource that is a member of this Group.",
+ "description": "The URI corresponding to a SCIM resource.",
"required": false,
"caseExact": false,
"mutability": "immutable",
@@ -56,7 +56,7 @@ json.attributes [
"name": "type",
"type": "string",
"multiValued": false,
- "description": "A label indicating the type of resource, e.g., 'User' or 'Group'.",
+ "description": "A label indicating the type of resource",
"required": false,
"caseExact": false,
"canonicalValues": %w[
app/views/scim/v2/schemas/_user.scim.jbuilder
@@ -12,7 +12,7 @@ json.attributes [
"name": "userName",
"type": "string",
"multiValued": false,
- "description": "Unique identifier for the User, typically used by the user to directly authenticate to the service provider. Each User MUST include a non-empty userName value. This identifier MUST be unique across the service provider's entire set of Users. REQUIRED.",
+ "description": "Unique identifier for the User",
"required": true,
"caseExact": false,
"mutability": "readWrite",
@@ -23,7 +23,7 @@ json.attributes [
"name": "password",
"type": "string",
"multiValued": false,
- "description": "The User's cleartext password. This attribute is intended to be used as a means to specify an initial password when creating a new User or to reset an existing User's password.",
+ "description": "The User's cleartext password.",
"required": false,
"caseExact": false,
"mutability": "writeOnly",
@@ -34,14 +34,14 @@ json.attributes [
"name": "emails",
"type": "complex",
"multiValued": true,
- "description": "Email addresses for the user. The value SHOULD be canonicalized by the service provider, e.g., 'bjensen@example.com' instead of 'bjensen@EXAMPLE.COM'. Canonical type values of 'work', 'home', and 'other'.",
+ "description": "Email addresses for the user.",
"required": false,
"subAttributes": [
{
"name": "value",
"type": "string",
"multiValued": false,
- "description": "Email addresses for the user. The value SHOULD be canonicalized by the service provider, e.g., 'bjensen@example.com' instead of 'bjensen@EXAMPLE.COM'. Canonical type values of 'work', 'home', and 'other'.",
+ "description": "Email addresses for the user.",
"required": false,
"caseExact": false,
"mutability": "readWrite",
@@ -52,7 +52,7 @@ json.attributes [
"name": "primary",
"type": "boolean",
"multiValued": false,
- "description": "A Boolean value indicating the 'primary' or preferred attribute value for this attribute, e.g., the preferred mailing address or primary email address. The primary attribute value 'true' MUST appear no more than once.",
+ "description": "A Boolean value indicating the preferred email",
"required": false,
"mutability": "readWrite",
"returned": "default"
@@ -66,7 +66,7 @@ json.attributes [
"name": "groups",
"type": "complex",
"multiValued": true,
- "description": "A list of groups to which the user belongs, either through direct membership, through nested groups, or dynamically calculated.",
+ "description": "A list of groups to which the user belongs.",
"required": false,
"subAttributes": [
{
@@ -88,7 +88,7 @@ json.attributes [
Group
],
"multiValued": false,
- "description": "The URI of the corresponding 'Group' resource to which the user belongs.",
+ "description": "The URI of the corresponding 'Group' resource.",
"required": false,
"caseExact": false,
"mutability": "readOnly",
@@ -99,7 +99,7 @@ json.attributes [
"name": "display",
"type": "string",
"multiValued": false,
- "description": "A human-readable name, primarily used for display purposes. READ-ONLY.",
+ "description": "A human-readable name.",
"required": false,
"caseExact": false,
"mutability": "readOnly",