Module: AccessionHelper

Included in:
Accession::SampleAccessioning, SampleManifestExcel::Upload::Base, SamplesController, StudiesController
Defined in:
app/helpers/accession_helper.rb

Overview

Helper methods to determine accessionablity and permissions at application level.

See Study#samples_accessionable? for study level. See Sample#should_be_accessioned? for sample level.

Instance Method Summary collapse

Instance Method Details

#accessioning_enabled?Boolean

Checks if accessioning is enabled in this environment. This is controlled by a a feature flag

Returns:

  • (Boolean)

    true if accessioning is enabled, false otherwise



11
12
13
# File 'app/helpers/accession_helper.rb', line 11

def accessioning_enabled?
  Flipper.enabled?(:y25_706_enable_accessioning)
end

#permitted_to_accession?(object) ⇒ Boolean

Checks if the current user is permitted to accession the given object.

Parameters:

  • object (Sample, Study)

    the object to check permissions for

Returns:

  • (Boolean)

    true if the user has permission, false otherwise



18
19
20
# File 'app/helpers/accession_helper.rb', line 18

def permitted_to_accession?(object)
  can?(:accession, object) || false
end