Module: GraphqlDevise
- Defined in:
- lib/graphql_devise.rb,
lib/graphql_devise/engine.rb,
lib/graphql_devise/schema.rb,
lib/graphql_devise/version.rb,
lib/graphql_devise/route_mounter.rb,
lib/graphql_devise/schema_plugin.rb,
lib/graphql_devise/mutations/base.rb,
lib/graphql_devise/resolvers/base.rb,
lib/graphql_devise/mutations/login.rb,
lib/graphql_devise/resolvers/dummy.rb,
lib/graphql_devise/resource_loader.rb,
lib/graphql_devise/types/base_type.rb,
lib/graphql_devise/mutations/logout.rb,
lib/graphql_devise/types/base_field.rb,
lib/graphql_devise/types/query_type.rb,
lib/graphql_devise/errors/user_error.rb,
lib/graphql_devise/default_operations.rb,
lib/graphql_devise/errors/error_codes.rb,
lib/graphql_devise/mutations/register.rb,
lib/graphql_devise/types/mutation_type.rb,
lib/graphql_devise/types/credential_type.rb,
lib/graphql_devise/errors/execution_error.rb,
lib/graphql_devise/concerns/authenticatable.rb,
lib/graphql_devise/model/with_email_updater.rb,
app/helpers/graphql_devise/application_helper.rb,
lib/graphql_devise/concerns/set_user_by_token.rb,
lib/graphql_devise/errors/detailed_user_error.rb,
lib/graphql_devise/types/authenticatable_type.rb,
lib/graphql_devise/concerns/controller_methods.rb,
lib/graphql_devise/errors/authentication_error.rb,
lib/generators/graphql_devise/install_generator.rb,
lib/graphql_devise/concerns/field_authentication.rb,
lib/graphql_devise/mount_method/option_sanitizer.rb,
app/controllers/graphql_devise/graphql_controller.rb,
lib/graphql_devise/mount_method/options_validator.rb,
lib/graphql_devise/mount_method/supported_options.rb,
lib/graphql_devise/mount_method/operation_preparer.rb,
lib/graphql_devise/concerns/auth_controller_methods.rb,
lib/graphql_devise/mount_method/operation_sanitizer.rb,
lib/graphql_devise/concerns/additional_model_methods.rb,
app/controllers/graphql_devise/application_controller.rb,
lib/graphql_devise/mutations/update_password_with_token.rb,
lib/graphql_devise/concerns/additional_controller_methods.rb,
lib/graphql_devise/mutations/resend_confirmation_with_token.rb,
lib/graphql_devise/mutations/send_password_reset_with_token.rb,
lib/graphql_devise/mutations/confirm_registration_with_token.rb,
lib/graphql_devise/mount_method/option_sanitizers/hash_checker.rb,
lib/graphql_devise/mount_method/option_sanitizers/array_checker.rb,
lib/graphql_devise/mount_method/option_sanitizers/class_checker.rb,
lib/graphql_devise/mount_method/option_sanitizers/string_checker.rb,
lib/graphql_devise/mount_method/operation_preparers/gql_name_setter.rb,
lib/graphql_devise/mount_method/option_validators/skip_only_validator.rb,
lib/graphql_devise/mount_method/operation_preparers/resolver_type_setter.rb,
lib/graphql_devise/mount_method/operation_preparers/mutation_field_setter.rb,
lib/graphql_devise/mount_method/operation_preparers/resource_klass_setter.rb,
lib/graphql_devise/mount_method/operation_preparers/custom_operation_preparer.rb,
lib/graphql_devise/mount_method/operation_preparers/default_operation_preparer.rb,
lib/graphql_devise/mount_method/option_validators/provided_operations_validator.rb,
lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
Defined Under Namespace
Modules: AdditionalControllerMethods, AdditionalModelMethods, ApplicationHelper, AuthControllerMethods, Authenticatable, ControllerMethods, DefaultOperations, FieldAuthentication, Model, MountMethod, Mutations, Resolvers, RouteMounter, SetUserByToken, Types
Classes: AuthenticationError, DetailedUserError, Engine, Error, ExecutionError, GraphqlController, InstallGenerator, InvalidMountOptionsError, ResourceLoader, Schema, SchemaPlugin, UserError
Constant Summary
collapse
- VERSION =
'1.5.0'
- ERROR_CODES =
{
user_error: 'USER_ERROR',
authentication_error: 'AUTHENTICATION_ERROR'
}.freeze
- ApplicationController =
if Rails::VERSION::MAJOR >= 5
Class.new(ActionController::API)
else
Class.new(ActionController::Base)
end
Class Method Summary
collapse
Class Method Details
.add_mapping(mapping_name, resource) ⇒ Object
49
50
51
52
53
54
55
56
|
# File 'lib/graphql_devise.rb', line 49
def self.add_mapping(mapping_name, resource)
return if Devise.mappings.key?(mapping_name.to_sym)
Devise.add_mapping(
mapping_name.to_s.pluralize.to_sym,
module: :devise, class_name: resource.to_s
)
end
|
62
63
64
65
66
67
68
69
70
|
# File 'lib/graphql_devise.rb', line 62
def self.configure_warden_serializer_for_model(model)
Devise.warden_config.serialize_into_session(to_mapping_name(model)) do |record|
model.serialize_into_session(record)
end
Devise.warden_config.serialize_from_session(to_mapping_name(model)) do |args|
model.serialize_from_session(*args)
end
end
|
.load_schema ⇒ Object
37
38
39
|
# File 'lib/graphql_devise.rb', line 37
def self.load_schema
@schema_loaded = true
end
|
.mount_resource(model) ⇒ Object
45
46
47
|
# File 'lib/graphql_devise.rb', line 45
def self.mount_resource(model)
@mounted_resources << model
end
|
.resource_mounted?(model) ⇒ Boolean
41
42
43
|
# File 'lib/graphql_devise.rb', line 41
def self.resource_mounted?(model)
@mounted_resources.include?(model)
end
|
.schema_loaded? ⇒ Boolean
33
34
35
|
# File 'lib/graphql_devise.rb', line 33
def self.schema_loaded?
@schema_loaded
end
|
.to_mapping_name(resource) ⇒ Object
58
59
60
|
# File 'lib/graphql_devise.rb', line 58
def self.to_mapping_name(resource)
resource.to_s.underscore.tr('/', '_')
end
|