Skip to content

Commit

Permalink
Merge branch 'main' into adventist_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf authored Dec 12, 2023
2 parents dbe996e + 2f23cc7 commit 2f2f4dc
Show file tree
Hide file tree
Showing 45 changed files with 277 additions and 51 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ HYKU_ADMIN_ONLY_TENANT_CREATION=false
HYKU_DEFAULT_HOST=%{tenant}.hyku.test
HYKU_ROOT_HOST=hyku.test
HYKU_MULTITENANT=true
HYKU_USER_DEFAULT_PASSWORD=password
# Comment out these 2 for multi tenancy / Uncomment for single
# HYKU_ROOT_HOST=hyku.test
# HYKU_MULTITENANT=false
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ gem 'i18n-tasks', group: %i[development test]
gem 'iiif_print', github: 'scientist-softserv/iiif_print', branch: 'main'
gem 'jbuilder', '~> 2.5'
gem 'jquery-rails' # Use jquery as the JavaScript library
# The maintainers yanked 0.3.2 version (see https://github.com/dryruby/json-canonicalization/issues/2)
gem 'json-canonicalization', "0.3.1"
gem 'launchy', group: %i[test]
gem 'listen', '>= 3.0.5', '< 3.2', group: %i[development]
gem 'lograge'
Expand Down
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ GEM
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (2.6.3)
json-canonicalization (0.3.2)
json-canonicalization (0.3.1)
json-jwt (1.15.3)
activesupport (>= 4.2)
aes_key_wrap
Expand Down Expand Up @@ -1357,6 +1357,7 @@ DEPENDENCIES
iiif_print!
jbuilder (~> 2.5)
jquery-rails
json-canonicalization (= 0.3.1)
launchy
listen (>= 3.0.5, < 3.2)
lograge
Expand Down
13 changes: 12 additions & 1 deletion app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@ def destroy
if @user.present? && @user.roles.destroy_all
redirect_to hyrax.admin_users_path, notice: t('hyrax.admin.users.destroy.success', user: @user)
else
redirect_to hyrax.admin_users_path flash: { error: t('hyrax.admin.users.destroy.failure', user: @user) }
redirect_to hyrax.admin_users_path, flash: { error: t('hyrax.admin.users.destroy.failure', user: @user) }
end
end

def activate
user = User.find(params[:id])
user.password = ENV.fetch('HYKU_USER_DEFAULT_PASSWORD', 'password')

if user.save && user.accept_invitation!
redirect_to hyrax.admin_users_path, notice: t('hyrax.admin.users.activate.success', user: user)
else
redirect_to hyrax.admin_users_path, flash: { error: t('hyrax.admin.users.activate.failure', user: user) }
end
end

Expand Down
17 changes: 16 additions & 1 deletion app/models/concerns/hyrax/ability/work_ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,25 @@ def work_roles
doc = permissions_doc(id)
all_work_types_and_files.include?(doc.hydra_model)
end
elsif work_depositor?
elsif work_depositor? || admin_set_with_deposit?
can %i[create], all_work_types_and_files
end
end

# OVERRIDE HYRAX 3.5.0 to return false if no ids are found
# @return [Boolean] true if the user has at least one admin set they can deposit into.
def admin_set_with_deposit?
ids = PermissionTemplateAccess.for_user(ability: self,
access: ['deposit', 'manage'])
.joins(:permission_template)
.select(:source_id)
.distinct
.pluck(:source_id)

return false if ids.empty?

Hyrax.custom_queries.find_ids_by_model(model: Hyrax::AdministrativeSet, ids: ids).any?
end
end
end
end
8 changes: 5 additions & 3 deletions app/models/generic_work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
class GenericWork < ActiveFedora::Base
include ::Hyrax::WorkBehavior
include ::Hyrax::BasicMetadata
include IiifPrint.model_configuration(
pdf_split_child_model: self
)
if ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYKU_IIIF_PRINT', false))
include IiifPrint.model_configuration(
pdf_split_child_model: self
)
end

validates :title, presence: { message: 'Your work must have a title.' }

Expand Down
8 changes: 5 additions & 3 deletions app/models/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
# `rails generate hyrax:work Image`
class Image < ActiveFedora::Base
include ::Hyrax::WorkBehavior
include IiifPrint.model_configuration(
pdf_split_child_model: self
)
if ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYKU_IIIF_PRINT', false))
include IiifPrint.model_configuration(
pdf_split_child_model: self
)
end

property :extent, predicate: ::RDF::Vocab::DC.extent, multiple: true do |index|
index.as :stored_searchable
Expand Down
7 changes: 5 additions & 2 deletions app/views/hyrax/admin/users/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@invite_roles_options.map { |r| [r.titleize, r ]},
{ prompt: 'Select a role...' },
required: false,
class: 'form-control' %>
class: 'form-control' %>
<%= f.submit t('.add'), class: 'btn btn-primary' %>
</div>
<% end %>
Expand Down Expand Up @@ -87,7 +87,10 @@
<td><%= user.accepted_or_not_invited? ? t('.status.active') : t('.status.pending') %></td>
<% if can? :destroy, User %>
<td>
<%= link_to t('.delete'), main_app.admin_user_path(user), class: 'btn btn-danger btn-sm action-delete', method: :delete, data: { confirm: t('hyrax.admin.users.destroy.confirmation', user: user.email) } %>
<%= link_to t('.delete'), main_app.admin_user_path(user), class: 'btn btn-danger btn-sm action-delete', method: :delete, data: { confirm: t('hyrax.admin.users.destroy.confirmation', user: user.email) } %>
<% if user.invited_to_sign_up? %>
<%= link_to t('.activate'), main_app.activate_admin_user_path(user.id), class: 'btn btn-primary btn-sm', method: :post, data: { confirm: t('hyrax.admin.users.activate.confirmation', user: user.email) } %>
<% end %>
</td>
<% end %>
</tr>
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
<%= yield :head %>
</head>
<body>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
<%# Add content_for block to clear caching so IR icons don't duplicate unintentionally %>
<% content_for :head do %>
<meta name="turbolinks-cache-control" content="no-cache">
<% end %>

<div class="carousel institutional-repository-carousel slide" id="carousel-tilenav" data-interval="false">
<div class="carousel-inner">
<% resource_types.each.with_index do |(k,v), i| %>
<% next if v[0].zero? %>
<div class="item <%= i.zero? ? 'active' : '' %>">
<div class="col-xs-12 col-sm-3 col-md-2">
<div class="text-center">
<i class='<%= "#{v[1]}" %>' aria-hidden="true"></i>
<h5><%= k %></h5>
<p><%= v[0] %></p>
<%= link_to "/catalog?f[resource_type_sim][]=#{k}", style: "color: inherit;" do %>
<i class='<%= "#{v[1]}" %>' aria-hidden="true"></i>
<h5><%= k %></h5>
<p><%= v[0] %></p>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
<a class="left carousel-control" href="#carousel-tilenav" data-slide="prev"><i class="glyphicon glyphicon-menu-left"></i></a>
<a class="right carousel-control" href="#carousel-tilenav" data-slide="next"><i class="glyphicon glyphicon-menu-right"></i></a>
</div>
</div>
2 changes: 1 addition & 1 deletion config/initializers/hyrax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Injected via `rails g hyrax:work Image`
config.register_curation_concern :image

# Email recipient of messages sent via the contact form
# The email address that messages submitted via the contact page are sent to
# This is set by account settings
# config.contact_email = 'changeme@example.com'

Expand Down
2 changes: 1 addition & 1 deletion config/initializers/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Hyku
VERSION = '5.0.1'.freeze
VERSION = '5.1.0'.freeze
end
15 changes: 15 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ de:
work_types: Verfügbare Arbeitstypen
footer:
admin_login: Administratorenlogin
identity_provider:
header: Authentifizierungsidentitätsanbieter
label:
logo_image: Bild für die SSO-Seite
logo_image_alt_text: Alternativtext für Bild
name: Name oder Beschreibung
optoins: Optionen
provider: Anbieter
proprietor:
accounts:
nav: Konten
Expand Down Expand Up @@ -210,6 +218,10 @@ de:
roles_and_permissions: Benutzer und Gruppen
system_status: Systemstatus
users:
activate:
confirmation: Sind Sie sicher, dass Sie den Benutzer „%{user}“ aktivieren möchten?
failure: Benutzer „%{user}“ konnte nicht aktiviert werden.
success: Benutzer „%{user}“ wurde erfolgreich aktiviert.
destroy:
confirmation: Möchten Sie den Benutzer "%{user}" wirklich löschen? Diese Aktion lässt sich nicht rückgängig machen.
failure: Benutzer "%{user}" konnte nicht gelöscht werden.
Expand Down Expand Up @@ -278,6 +290,9 @@ de:
edit: Bearbeiten
header: Benutzer verwalten
update: Aktualisieren
single_signon:
index:
sign_in_with_provider: Melden Sie sich mit %{provider} an
status:
index:
services: Dienste
Expand Down
4 changes: 1 addition & 3 deletions config/locales/devise_invitable.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ de:
accept: Die Einladung annehmen
accept_until: Diese Einladung wird in %{due_date} fällig.
hello: Hallo %{email}
ignore: |-
Wenn Sie die Einladung nicht akzeptieren möchten, ignorieren Sie bitte diese E-Mail.
Ihr Konto wird erst dann erstellt, wenn Sie auf den obigen Link zugreifen und Ihr Passwort festlegen.
ignore: "Wenn Sie die Einladung nicht akzeptieren möchten, ignorieren Sie bitte diese E-Mail. \nIhr Konto wird erst dann erstellt, wenn Sie auf den obigen Link zugreifen und Ihr Passwort festlegen."
someone_invited_you: Jemand hat Sie zu %{url} eingeladen, können Sie es über den Link unten akzeptieren.
subject: Einladungshinweise
time:
Expand Down
4 changes: 1 addition & 3 deletions config/locales/devise_invitable.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ es:
accept: Aceptar la invitacion
accept_until: Esta invitación será %{due_date}.
hello: Hola %{email}
ignore: |-
Si no desea aceptar la invitación, ignore este correo electrónico.
Su cuenta no se creará hasta que acceda al enlace anterior y establezca su contraseña.
ignore: "Si no desea aceptar la invitación, ignore este correo electrónico. \nSu cuenta no se creará hasta que acceda al enlace anterior y establezca su contraseña."
someone_invited_you: Alguien te ha invitado a %{url}, puedes aceptarlo a través del siguiente enlace.
subject: Instrucciones de invitación
time:
Expand Down
4 changes: 1 addition & 3 deletions config/locales/devise_invitable.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ fr:
accept: Accepter l'invitation
accept_until: Cette invitation sera due en %{due_date}.
hello: Bonjour %{email}
ignore: |-
Si vous ne souhaitez pas accepter l'invitation, ignorez ce courriel.
Votre compte ne sera créé que lorsque vous accédez au lien ci-dessus et définissez votre mot de passe.
ignore: "Si vous ne souhaitez pas accepter l'invitation, ignorez ce courriel. \nVotre compte ne sera créé que lorsque vous accédez au lien ci-dessus et définissez votre mot de passe."
someone_invited_you: Quelqu'un vous a invité %{url}, vous pouvez l'accepter par le lien ci-dessous.
subject: Instructions d'invitation
time:
Expand Down
4 changes: 1 addition & 3 deletions config/locales/devise_invitable.it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ it:
accept: Accetta l'invito
accept_until: Questo invito sarà dovuto in %{due_date}.
hello: Ciao %{email}
ignore: |-
Se non desideri accettare l'invito, ignora questa email.
Il tuo account non verrà creato finché non accedi al link precedente e imposta la tua password.
ignore: "Se non desideri accettare l'invito, ignora questa email. \nIl tuo account non verrà creato finché non accedi al link precedente e imposta la tua password."
someone_invited_you: Qualcuno ti ha invitato a %{url}, puoi accettarlo tramite il link qui sotto.
subject: Istruzioni di invito
time:
Expand Down
4 changes: 1 addition & 3 deletions config/locales/devise_invitable.pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ pt-BR:
accept: Aceitar convite
accept_until: Este convite será devido em %{due_date}.
hello: Olá %{email}
ignore: |-
Se você não deseja aceitar o convite, ignore este e-mail.
Sua conta não será criada até você acessar o link acima e definir sua senha.
ignore: "Se você não deseja aceitar o convite, ignore este e-mail. \nSua conta não será criada até você acessar o link acima e definir sua senha."
someone_invited_you: Alguém convidou você para %{url}, você pode aceitá-lo através do link abaixo.
subject: Instruções de convite
time:
Expand Down
4 changes: 4 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ en:
repository_activity: Repository Activity
system_status: System Status
users:
activate:
confirmation: Are you sure you want to activate the user "%{user}"?
failure: User "%{user}" could not be activated.
success: User "%{user}" has been successfully activated.
destroy:
confirmation: Are you sure you wish to delete the user "%{user}"? This action is irreversible.
failure: User "%{user}" could not be deleted.
Expand Down
15 changes: 15 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ es:
work_types: Tipos de trabajo disponibles
footer:
admin_login: Acceso del administrador
identity_provider:
header: Proveedor de identidad de autenticación
label:
logo_image: Imagen para la página SSO
logo_image_alt_text: Texto alternativo para imagen
name: Nombre o descripción
optoins: Opciones
provider: Proveedor
proprietor:
accounts:
nav: Cuentas
Expand Down Expand Up @@ -207,6 +215,10 @@ es:
repository_activity: Actividad del repositorio
system_status: Estado del sistema
users:
activate:
confirmation: ¿Estás seguro de que deseas activar el usuario "%{user}"?
failure: No se pudo activar el usuario "%{user}".
success: El usuario "%{user}" se ha activado correctamente.
destroy:
confirmation: ¿Estás seguro de que deseas eliminar el usuario "%{user}"? Esta acción es irreversible.
failure: El usuario "%{user}" no pudo ser eliminado.
Expand Down Expand Up @@ -275,6 +287,9 @@ es:
edit: Editar
header: Administrar usuario
update: Actualizar
single_signon:
index:
sign_in_with_provider: Iniciar sesión con %{provider}
status:
index:
services: Servicios
Expand Down
15 changes: 15 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ fr:
work_types: Types de travail disponibles
footer:
admin_login: Connexion Administrateur
identity_provider:
header: Fournisseur d'identité d'authentification
label:
logo_image: Image de la page SSO
logo_image_alt_text: Texte alternatif pour l'image
name: Nom ou description
optoins: Possibilités
provider: Fournisseur
proprietor:
accounts:
nav: Comptes
Expand Down Expand Up @@ -212,6 +220,10 @@ fr:
system_status: État du système
technical: Technique
users:
activate:
confirmation: Etes-vous sûr de vouloir activer l'utilisateur "%{user}" ?
failure: L'utilisateur "%{user}" n'a pas pu être activé.
success: L'utilisateur "%{user}" a été activé avec succès.
destroy:
confirmation: Voulez-vous vraiment supprimer l'utilisateur "%{user}"? Cette action est irréversible.
failure: L'utilisateur "%{user}" n'a pas pu être supprimé.
Expand Down Expand Up @@ -280,6 +292,9 @@ fr:
edit: Modifier
header: Gérer l'utilisateur
update: Mettre à jour
single_signon:
index:
sign_in_with_provider: Connectez-vous avec %{provider}
status:
index:
services: Prestations de service
Expand Down
1 change: 1 addition & 0 deletions config/locales/hyrax.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ de:
collections: Sammlungen
configuration: Aufbau
contact: Kontakt
identity_provider: Identitätsanbieter
notifications: Benachrichtigungen
pages: Seiten
profile: Profil
Expand Down
1 change: 1 addition & 0 deletions config/locales/hyrax.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ es:
configuration: Configuración
contact: Contacto
content_blocks: Bloques de contenido
identity_provider: Proveedor de identidad
notifications: Notificaciones
pages: Páginas
profile: Perfil
Expand Down
1 change: 1 addition & 0 deletions config/locales/hyrax.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ fr:
collections: Les collections
configuration: Configuration
contact: Contact
identity_provider: Fournisseur d'identité
notifications: Notifications
pages: Pages
profile: Profil
Expand Down
1 change: 1 addition & 0 deletions config/locales/hyrax.it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ it:
configuration: Configurazione
contact: Contatto
content_blocks: Blocchi di contenuto
identity_provider: Fornitore di identità
notifications: notifiche
pages: pagine
profile: Profilo
Expand Down
1 change: 1 addition & 0 deletions config/locales/hyrax.pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ pt-BR:
configuration: Configuração
contact: Contato
content_blocks: Blocos de Conteúdo
identity_provider: Provedor de identidade
notifications: Notificações
pages: Páginas
profile: Perfil
Expand Down
Loading

0 comments on commit 2f2f4dc

Please sign in to comment.