Sha256: ac59453b83c7be49de127af0cb5b480293629778078d875a8851f71b5d69b206

Contents?: true

Size: 659 Bytes

Versions: 27

Compression:

Stored size: 659 Bytes

Contents

module Api
  class OrganizationsController < BaseController
    include OrganizationsControllerTemplate

    before_action :authorize_janitor!, only: [:show, :index]
    before_action :authorize_owner!, only: [:update, :create]

    def index
      render json: { organizations: Organization.accessible_as(current_user, :janitor) }
    end

    def show
      render json: @organization.to_resource_h
    end

    def create
      @organization.save_and_notify!
      render json: @organization.to_resource_h
    end

    def update
      @organization.update_and_notify! organization_params

      render json: @organization.to_resource_h
    end
  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
mumuki-laboratory-6.7.7 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.7.6 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.7.5 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.7.4 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.7.3 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.7.2 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.7.1 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.7.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.6.1 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.6.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.5.1 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.5.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.4.2 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.4.1 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.4.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.2.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.1.5 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.0.4 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.1.4 app/controllers/api/organizations_controller.rb
mumuki-laboratory-6.1.3 app/controllers/api/organizations_controller.rb