Module: Core::Abilities

Defined in:
app/api/core/abilities.rb

Overview

The classes within this namespace are responsible for defining the abilities of the user and the application that are accessing the API.

-- To maintain the behaviour of the API before this was introduced the logic is very straight-forward:

  1. If the application is authorised then everything is possible.
  2. If the application is unauthorised then the user capabilities take priority.

There are several pieces of functionality that are always accessible:

  • UUID lookups are always available
  • Searches are always available
  • Submissions can be created and updated
  • Sample manifests can be created through studies and updated individually

In the future we'll be able to adjust this and get the right behaviour based on the combination of the application and the user. We'll also be able to extend the application abilities so that they are refined for certain applications. ++

Defined Under Namespace

Modules: ActionBehaviour Classes: Application, Base, CompositeAbility, User

Class Method Summary collapse

Class Method Details

.create(request) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/api/core/abilities.rb', line 24

 do
  # NOTE: The following attribute is not required for Microarray Genotyping.
  # I think this might be broken and suggests that there should be separate classes for project: one for
  # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping
  # that doesn't.
  include ProjectManager::Associations
  include BudgetDivision::Associations

  custom_attribute(:project_cost_code, required: true)
  custom_attribute(:funding_comments)
  custom_attribute(:collaborators)
  custom_attribute(:external_funding_source)
  custom_attribute(:sequencing_budget_cost_centre)
  custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS)
  custom_attribute(:gt_committee_tracking_id)

  before_validation do |record|
    record.project_cost_code = nil if record.project_cost_code.blank?
    record.project_funding_model = nil if record.project_funding_model.blank?
  end
end