Class: AdminSet
- Inherits:
-
ActiveFedora::Base
- Object
- ActiveFedora::Base
- AdminSet
- Includes:
- Hydra::AccessControls::Permissions, Hyrax::HasRepresentative, Hyrax::HumanReadableType, Hyrax::Noid, Hyrax::Permissions
- Defined in:
- app/models/admin_set.rb
Overview
There is an interplay between an AdminSet and a PermissionTemplate. Given that AdminSet is an ActiveFedora::Base and PermissionTemplate is ActiveRecord::Base we don’t have the usual :has_many or :belongs_to methods to assist in defining that relationship. However, from a conceptual standpoint:
-
An AdminSet has_one :permission_tempate
-
A PermissionTemplate belongs_to :admin_set
When an object is added as a member of an AdminSet, the AdminSet’s associated PermissionTemplate is applied to that object (e.g. some of the object’s attributes are updated as per the rules of the permission template)
Constant Summary collapse
- DEFAULT_ID =
Hyrax::AdminSetCreateService::DEFAULT_ID
- DEFAULT_TITLE =
Hyrax::AdminSetCreateService::DEFAULT_TITLE
- DEFAULT_WORKFLOW_NAME =
Hyrax.config.default_active_workflow_name
Class Attributes collapse
Class Method Summary collapse
Instance Method Summary collapse
- #active_workflow ⇒ Sipity::Workflow
-
#assign_id ⇒ Object
return an id for the AdminSet.
- #collection_type_gid ⇒ Object
-
#permission_template ⇒ Hyrax::PermissionTemplate
A bit of an analogue for a ‘has_one :admin_set` as it crosses from Fedora to the DB.
- #to_rdf_representation ⇒ Object
- #to_s ⇒ Object
Methods included from Hyrax::Permissions::Readable
#private?, #public?, #registered?
Methods included from Hyrax::Permissions::Writable
Methods included from Hyrax::HumanReadableType
#human_readable_type, #to_solr
Methods inherited from ActiveFedora::Base
Instance Attribute Details
#internal_resource ⇒ String
37 |
# File 'app/models/admin_set.rb', line 37 class_attribute :internal_resource, default: "AdminSet" |
Class Method Details
.to_rdf_representation ⇒ Object
43 44 45 |
# File 'app/models/admin_set.rb', line 43 def self.to_rdf_representation internal_resource end |
Instance Method Details
#active_workflow ⇒ Sipity::Workflow
85 86 87 |
# File 'app/models/admin_set.rb', line 85 def active_workflow Sipity::Workflow.find_active_workflow_for(admin_set_id: id) end |
#assign_id ⇒ Object
return an id for the AdminSet. defaults to calling Hyrax::Noid, but needs a fall back if noid is off
93 94 95 |
# File 'app/models/admin_set.rb', line 93 def assign_id super || SecureRandom.uuid end |
#collection_type_gid ⇒ Object
64 65 66 67 |
# File 'app/models/admin_set.rb', line 64 def collection_type_gid # allow AdminSet to behave more like a regular Collection Hyrax::CollectionType.find_or_create_admin_set_type.to_global_id end |
#permission_template ⇒ Hyrax::PermissionTemplate
A bit of an analogue for a ‘has_one :admin_set` as it crosses from Fedora to the DB
77 78 79 |
# File 'app/models/admin_set.rb', line 77 def Hyrax::PermissionTemplate.find_by!(source_id: id) end |
#to_rdf_representation ⇒ Object
47 48 49 |
# File 'app/models/admin_set.rb', line 47 def to_rdf_representation internal_resource end |
#to_s ⇒ Object
69 70 71 |
# File 'app/models/admin_set.rb', line 69 def to_s title.presence || 'No Title' end |