Sha256: d7044c920d53eb3a44c8b0dd3fe9f913747a1cd4ba3fae6510c498f8285aafa5

Contents?: true

Size: 668 Bytes

Versions: 26

Compression:

Stored size: 668 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.as_platform_json
    end

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

    def update
      @organization.update_and_notify! organization_params

      render json: @organization.as_platform_json
    end
  end

end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
mumuki-laboratory-5.4.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-5.3.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-5.2.1 app/controllers/api/organizations_controller.rb
mumuki-laboratory-5.2.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-5.1.1 app/controllers/api/organizations_controller.rb
mumuki-laboratory-5.1.0 app/controllers/api/organizations_controller.rb