Sha256: 9acb221c703bec318ab57b6e36fe30d74cd7176a7f83134422e2b35adc870816

Contents?: true

Size: 636 Bytes

Versions: 12

Compression:

Stored size: 636 Bytes

Contents

module Api
  class OrganizationsController < BaseController
    include OrganizationsControllerTemplate

    before_action :authorize_janitor!, only: [:show, :index]
    before_action :authorize_admin!, 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!
      render json: @organization.to_resource_h
    end

    def update
      @organization.update! organization_params
      render json: @organization.to_resource_h
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mumuki-laboratory-8.6.1 app/controllers/api/organizations_controller.rb
mumuki-laboratory-8.6.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-8.5.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-8.4.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-8.3.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-8.2.1 app/controllers/api/organizations_controller.rb
mumuki-laboratory-8.2.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-8.1.3 app/controllers/api/organizations_controller.rb
mumuki-laboratory-8.1.2 app/controllers/api/organizations_controller.rb
mumuki-laboratory-8.1.1 app/controllers/api/organizations_controller.rb
mumuki-laboratory-8.1.0 app/controllers/api/organizations_controller.rb
mumuki-laboratory-8.0.0 app/controllers/api/organizations_controller.rb