From 19da983983f397714d8c1bfb76187c64219b947c Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Mon, 24 Jul 2023 09:56:34 -0700 Subject: [PATCH 1/5] move sidekiq dashboard name to standardized "jobs", make accessible within tenants --- app/models/user.rb | 4 ++++ config/routes.rb | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index ed7165aaf..d38d9efc2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -36,6 +36,10 @@ def to_s email end + def is_admin + has_role? :admin + end + def is_superadmin has_role? :superadmin end diff --git a/config/routes.rb b/config/routes.rb index f08a9431b..757c86207 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,12 +6,12 @@ concern :iiif_search, BlacklightIiifSearch::Routes.new concern :oai_provider, BlacklightOaiProvider::Routes.new - + mount Hyrax::IiifAv::Engine, at: '/' mount Riiif::Engine => 'images', as: :riiif if Hyrax.config.iiif_image_server? - authenticate :user, lambda { |u| u.is_superadmin } do - mount Sidekiq::Web => '/sidekiq' + authenticate :user, lambda { |u| u.is_superadmin || u.is_admin } do + mount Sidekiq::Web => '/jobs' end if ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYKU_MULTITENANT', false)) From a5eddc844d57b3b1d70efe717be6cc1c5601cc6f Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Mon, 24 Jul 2023 10:09:49 -0700 Subject: [PATCH 2/5] more complete admin check --- app/models/user.rb | 2 +- docker-compose.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index d38d9efc2..7a106bbfc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -37,7 +37,7 @@ def to_s end def is_admin - has_role? :admin + has_role? :admin || has_role? :admin, Site.instance end def is_superadmin diff --git a/docker-compose.yml b/docker-compose.yml index 482acb98f..4dedd2b58 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -131,6 +131,7 @@ services: <<: *app # Uncomment command to access container with out starting Rails. Useful for debugging # command: sleep infinity + command: sh -l -c "bundle && bundle exec rails s -b 0.0.0.0" environment: - VIRTUAL_PORT=3000 - VIRTUAL_HOST=.hyku.test From 1c9f7bf943f5249b8e9030194469fbde8ac8cdb6 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Mon, 24 Jul 2023 10:16:20 -0700 Subject: [PATCH 3/5] better user syntax --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 7a106bbfc..769d0fef2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -37,7 +37,7 @@ def to_s end def is_admin - has_role? :admin || has_role? :admin, Site.instance + has_role?(:admin) || has_role?(:admin, Site.instance) end def is_superadmin From ca5ee6089c7d5cd7ce7c5acc83a21d12dbc95949 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Mon, 18 Sep 2023 16:00:56 -0700 Subject: [PATCH 4/5] Update docker-compose.yml --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4dedd2b58..482acb98f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -131,7 +131,6 @@ services: <<: *app # Uncomment command to access container with out starting Rails. Useful for debugging # command: sleep infinity - command: sh -l -c "bundle && bundle exec rails s -b 0.0.0.0" environment: - VIRTUAL_PORT=3000 - VIRTUAL_HOST=.hyku.test From 7872da2607012142fadb1fb64724c74243b8ab86 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Mon, 18 Sep 2023 16:09:52 -0700 Subject: [PATCH 5/5] Update routes.rb --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 6b123b7cb..73a5d0f50 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,7 +12,7 @@ mount Hyrax::IiifAv::Engine, at: '/' mount Riiif::Engine => 'images', as: :riiif if Hyrax.config.iiif_image_server? - authenticate :user, ->(u) { |u| u.is_superadmin || u.is_admin } do + authenticate :user, ->(u) { u.is_superadmin || u.is_admin } do mount Sidekiq::Web => '/jobs' end