Module: Ddr::Models::HasAdminMetadata

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/ddr/models/has_admin_metadata.rb

Instance Method Summary collapse

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_licenseObject



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 effective_permissions(agents)
  Ddr::Auth::EffectivePermissions.call(self, agents)
end

#finding_aidObject



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_licenseObject



117
118
119
# File 'lib/ddr/models/has_admin_metadata.rb', line 117

def inherited_license
  InheritedLicense.call(self)
end

#inherited_rolesObject



83
84
85
# File 'lib/ddr/models/has_admin_metadata.rb', line 83

def inherited_roles
  Ddr::Auth::InheritedRoles.call(self)
end

#lockObject



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

Returns:

  • (Boolean)


127
128
129
# File 'lib/ddr/models/has_admin_metadata.rb', line 127

def locked?
  !!is_locked
end

#permanent_id_managerObject



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_helpObject



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

#rolesObject



79
80
81
# File 'lib/ddr/models/has_admin_metadata.rb', line 79

def roles
  Ddr::Auth::Roles::RoleSetManager.new(self)
end

#unlockObject



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

#workflowObject



87
88
89
# File 'lib/ddr/models/has_admin_metadata.rb', line 87

def workflow
  @workflow ||= Ddr::Managers::WorkflowManager.new(self)
end