Sha256: 3b96cf92492b89caf2982bbbca7378660692a04efc8b2e5e522c2a7a4aed99ec

Contents?: true

Size: 667 Bytes

Versions: 4

Compression:

Stored size: 667 Bytes

Contents

module Maestrano
  module Api
    class UserResource < BaseResource
      @model_class = Maestrano::Connector::Rails::User

      # == Attributes ===========================================================
      attribute :first_name
      attribute :provider
      attribute :last_name
      attribute :email
      attribute :tenant
      attribute :uid

      def save
        @model.tenant = context[:client]
        super
        return unless org_uid == context.dig(:params, :org_uid)

        org = Maestrano::Connector::Rails::Organization.find_by(org_uid: org_uid)
        org.add_member(@model) unless !org || org.member?(@model)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
maestrano-connector-rails-2.3.6 app/resources/maestrano/api/user_resource.rb
maestrano-connector-rails-2.3.5 app/resources/maestrano/api/user_resource.rb
maestrano-connector-rails-2.3.4 app/resources/maestrano/api/user_resource.rb
maestrano-connector-rails-2.3.3 app/resources/maestrano/api/user_resource.rb