lib/osso/graphql/mutations/configure_identity_provider.rb in osso-0.0.3.5 vs lib/osso/graphql/mutations/configure_identity_provider.rb in osso-0.0.3.6
- old
+ new
@@ -4,26 +4,23 @@
module GraphQL
module Mutations
class ConfigureIdentityProvider < BaseMutation
null false
argument :id, ID, required: true
- argument :service, Types::IdentityProviderService, required: true
- argument :sso_url, String, required: true
- argument :sso_cert, String, required: true
+ argument :service, Types::IdentityProviderService, required: false
+ argument :sso_url, String, required: false
+ argument :sso_cert, String, required: false
- field :identity_provider, Types::IdentityProvider, null: true
+ field :identity_provider, Types::IdentityProvider, null: false
field :errors, [String], null: false
- def resolve(id:, sso_url:, sso_cert:, service:)
- provider = Osso::Models::SamlProvider.find(id)
- provider.update(
- idp_cert: sso_cert,
- idp_sso_target_url: sso_url,
- )
+ def resolve(id:, **args)
+ provider = Osso::Models::IdentityProvider.find(id)
- return_data(identity_provider: provider)
- # rescue StandardError => e
- # return_error(errors: e.full_message)
+ return unauthorized unless authorized?
+ return response_data(identity_provider: provider) if provider.update(args)
+
+ response_error(errors: provder.errors.messages)
end
end
end
end
end