Sha256: 295d98df66c7b45557a94f2f1510358113feb4918c19afa81f11ec00da918579
Contents?: true
Size: 1.26 KB
Versions: 4
Compression:
Stored size: 1.26 KB
Contents
# frozen_string_literal: true module Osso module GraphQL module Mutations class InviteAdminUser < BaseMutation null false argument :email, String, required: true argument :oauth_client_id, ID, required: false argument :role, String, required: true field :admin_user, Types::AdminUser, null: true field :errors, [String], null: false def resolve(email:, role:, oauth_client_id: nil) admin_user = Osso::Models::Account.new( email: email, role: role, oauth_client_id: oauth_client_id, ) if admin_user.save verify_user(email) Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: { invited_email: email, invited_role: role, invited_oauth_client_id: oauth_client_id, }) return response_data(admin_user: admin_user) end response_error(admin_user.errors) end def ready?(*) admin_ready? end def verify_user(email) context[:rodauth].account_from_login(email) context[:rodauth].setup_account_verification end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems