Sha256: e3e59eef1433afbd9953a1ba595490ad685282907c022b9c975d1b420266feb6

Contents?: true

Size: 1.42 KB

Versions: 14

Compression:

Stored size: 1.42 KB

Contents

module Sipity
  # A role is a responsibility to do things. That is to take actions. It is
  # easy to conflate a person's role with the groups to which they belong.
  # A group is a set of people. The association of group with role
  # indicates that the set of people have the same responsibilities.
  #
  # By separating Group and Role, we expose a more rich system in which we
  # can talk about group membership separate from the group's
  # responsibility.
  #
  # Another way to think of it is that a Group is a marco that expands to
  # represent people. A Role is a macro that expands to represent
  # responsibilities. In keeping them separate we can model more rich
  # relationships.
  #
  # @note Roles should be verbs. They are what you do.
  #
  # @note This model representes the "roles" that users of the system can
  #   have. It is not the "role" that they had in relation to the scholarly
  #   work that is being deposited (i.e. co-author on a paper).
  #
  # @see Sipity::Agent
  class Role < ActiveRecord::Base
    self.table_name = 'sipity_roles'

    has_many :workflow_roles,
             dependent: :destroy,
             class_name: 'Sipity::WorkflowRole'

    has_many :email_recipients,
             dependent: :destroy,
             foreign_key: :role_id,
             class_name: 'Sipity::NotificationRecipient'

    def self.[](name)
      find_or_create_by!(name: name.to_s)
    end

    def to_s
      name
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
curation_concerns-1.7.8 app/models/sipity/role.rb
curation_concerns-1.7.7 app/models/sipity/role.rb
curation_concerns-2.0.0 app/models/sipity/role.rb
curation_concerns-2.0.0.rc2 app/models/sipity/role.rb
curation_concerns-1.7.6 app/models/sipity/role.rb
curation_concerns-1.7.5 app/models/sipity/role.rb
test_hyrax-0.0.1.alpha app/models/sipity/role.rb
curation_concerns-1.7.4 app/models/sipity/role.rb
curation_concerns-1.7.3 app/models/sipity/role.rb
curation_concerns-1.7.2 app/models/sipity/role.rb
curation_concerns-2.0.0.rc1 app/models/sipity/role.rb
curation_concerns-1.7.1 app/models/sipity/role.rb
curation_concerns-1.7.0 app/models/sipity/role.rb
curation_concerns-1.7.0.beta1 app/models/sipity/role.rb