Sha256: 2379957e85aa387b2deb357a31ebc9c2162146df6cfd249349d52412dd9a63b6

Contents?: true

Size: 666 Bytes

Versions: 5

Compression:

Stored size: 666 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

5 entries across 5 versions & 1 rubygems

Version Path
maestrano-connector-rails-2.3.2 app/resources/maestrano/api/user_resource.rb
maestrano-connector-rails-2.3.1 app/resources/maestrano/api/user_resource.rb
maestrano-connector-rails-2.3.0 app/resources/maestrano/api/user_resource.rb
maestrano-connector-rails-2.2.1 app/resources/maestrano/api/user_resource.rb
maestrano-connector-rails-2.2.0 app/resources/maestrano/api/user_resource.rb