Sha256: 10bb112f043e938d8b970fc77b6e21c725d534789e5f0694955f9c757a604c3d

Contents?: true

Size: 828 Bytes

Versions: 5

Compression:

Stored size: 828 Bytes

Contents

class Maestrano::Account::GroupsController < Maestrano::Rails::WebHookController
  # DELETE /maestrano/account/groups/cld-1/tenant
  # Delete an entire group
  def destroy
    # id
    org_uid = params[:id]

    # Get entity
    organization = Maestrano::Connector::Rails::Organization.find_by(uid: org_uid, tenant: params[:tenant] || 'default')

    unless organization
      Maestrano::Connector::Rails::ConnectorLogger.log('info', nil, 'Organization not found')
      return render json: {success: true}, status: :no_content
    end

    Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, 'delete organization')

    # Delete all relations
    organization.user_organization_rels.delete_all

    # Delete the organization
    organization.destroy

    # Respond
    render json: {success: true}
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
maestrano-connector-rails-2.3.6 app/controllers/maestrano/account/groups_controller.rb
maestrano-connector-rails-2.3.5 app/controllers/maestrano/account/groups_controller.rb
maestrano-connector-rails-2.3.4 app/controllers/maestrano/account/groups_controller.rb
maestrano-connector-rails-2.3.3 app/controllers/maestrano/account/groups_controller.rb
maestrano-connector-rails-2.3.2 app/controllers/maestrano/account/groups_controller.rb