Module: Ddr::Models::HasAdminMetadata
- Extended by:
- ActiveSupport::Concern
- Included in:
- Base
- Defined in:
- lib/ddr/models/has_admin_metadata.rb
Instance Method Summary collapse
- #assign_permanent_id! ⇒ Object
- #copy_resource_roles_from(other) ⇒ Object
- #effective_license ⇒ Object
- #effective_permissions(agents) ⇒ Object
- #finding_aid ⇒ Object
- #grant_roles_to_creator(creator) ⇒ Object
- #inherited_license ⇒ Object
- #inherited_roles ⇒ Object
- #lock ⇒ Object
- #lock! ⇒ Object
- #locked? ⇒ Boolean
- #permanent_id_manager ⇒ Object
- #research_help ⇒ Object
- #roles ⇒ Object
- #unlock ⇒ Object
- #unlock! ⇒ Object
- #workflow ⇒ Object
Instance Method Details
#assign_permanent_id! ⇒ Object
91 92 93 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 91 def assign_permanent_id! permanent_id_manager.assign_later end |
#copy_resource_roles_from(other) ⇒ Object
101 102 103 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 101 def copy_resource_roles_from(other) roles.grant *(Ddr::Auth::ResourceRoles.call(other)) end |
#effective_license ⇒ Object
113 114 115 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 113 def effective_license EffectiveLicense.call(self) end |
#effective_permissions(agents) ⇒ Object
105 106 107 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 105 def (agents) Ddr::Auth::EffectivePermissions.call(self, agents) end |
#finding_aid ⇒ Object
121 122 123 124 125 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 121 def finding_aid if ead_id FindingAid.new(ead_id) end end |
#grant_roles_to_creator(creator) ⇒ Object
95 96 97 98 99 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 95 def grant_roles_to_creator(creator) roles.grant role_type: Ddr::Auth::Roles::EDITOR, agent: creator, scope: Ddr::Auth::Roles::RESOURCE_SCOPE end |
#inherited_license ⇒ Object
117 118 119 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 117 def inherited_license InheritedLicense.call(self) end |
#inherited_roles ⇒ Object
83 84 85 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 83 def inherited_roles Ddr::Auth::InheritedRoles.call(self) end |
#lock ⇒ Object
131 132 133 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 131 def lock self.is_locked = true end |
#lock! ⇒ Object
139 140 141 142 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 139 def lock! lock save end |
#locked? ⇒ Boolean
127 128 129 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 127 def locked? !!is_locked end |
#permanent_id_manager ⇒ Object
75 76 77 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 75 def permanent_id_manager @permanent_id_manager ||= Ddr::Managers::PermanentIdManager.new(self) end |
#research_help ⇒ Object
109 110 111 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 109 def research_help Ddr::Models::Contact.call(research_help_contact) if research_help_contact end |
#roles ⇒ Object
79 80 81 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 79 def roles Ddr::Auth::Roles::RoleSetManager.new(self) end |
#unlock ⇒ Object
135 136 137 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 135 def unlock self.is_locked = false end |
#unlock! ⇒ Object
144 145 146 147 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 144 def unlock! unlock save end |
#workflow ⇒ Object
87 88 89 |
# File 'lib/ddr/models/has_admin_metadata.rb', line 87 def workflow @workflow ||= Ddr::Managers::WorkflowManager.new(self) end |