Sha256: d0bd1864de7f515327b92f64e5ab44610cc4249f32c999a3f8d331f95952006b

Contents?: true

Size: 530 Bytes

Versions: 3

Compression:

Stored size: 530 Bytes

Contents

module WithOrganizationStatus

  def status
    @status ||= _status
  end

  def access_mode(user)
    status.access_mode(user)
  end

  def validate_active!
    status.validate!
  end

  def validate_active_for!(user)
    status.validate!(user)
    access_mode(user).validate_active!
  end

  private

  def _status
    if disabled?
      Organization::Status::Disabled.new self
    elsif in_preparation?
      Organization::Status::InPreparation.new self
    else
      Organization::Status::Enabled.new self
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mumuki-domain-9.14.0 app/models/concerns/with_organization_status.rb
mumuki-domain-9.13.1 app/models/concerns/with_organization_status.rb
mumuki-domain-9.13.0 app/models/concerns/with_organization_status.rb