Compare commits

...

5 Commits

Author SHA1 Message Date
e0a34df7b7 Merge pull request 'fix-tenant-scope' (#159) from fix-tenant-scope into main
Some checks failed
Check usage of free licenses / check-licenses (push) Successful in 1m2s
Run unit tests / unit_tests (push) Successful in 2m57s
Build Nginx-based docker image / build-static-assets (push) Failing after 15m23s
Reviewed-on: #159
2024-12-02 19:35:36 +00:00
a96be2a79e Do not require a tenant scope for running tests
All checks were successful
Check usage of free licenses / check-licenses (pull_request) Successful in 47s
Add copyright notice / copyright_notice (pull_request) Successful in 1m35s
Run unit tests / unit_tests (pull_request) Successful in 2m24s
2024-12-02 20:33:05 +01:00
3ea1d1e7ec Add copyright notice
Some checks failed
Check usage of free licenses / check-licenses (pull_request) Successful in 1m39s
Add copyright notice / copyright_notice (pull_request) Successful in 1m56s
Run unit tests / unit_tests (pull_request) Failing after 2m44s
2024-12-02 08:05:46 +00:00
3fca449461 Limit visibility per tenant
Some checks failed
Add copyright notice / copyright_notice (pull_request) Successful in 57s
Check usage of free licenses / check-licenses (pull_request) Successful in 1m29s
Run unit tests / unit_tests (pull_request) Failing after 3m28s
2024-12-02 09:04:48 +01:00
ef573c5f73 Require a tenant to be configured for all queries 2024-12-02 08:57:10 +01:00
3 changed files with 15 additions and 6 deletions

View File

@ -1,6 +1,7 @@
# Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024 Manuel Bustillo
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
set_current_tenant_through_filter
before_action :set_tenant before_action :set_tenant
before_action :authenticate_user! before_action :authenticate_user!
after_action :set_csrf_cookie after_action :set_csrf_cookie
@ -47,7 +48,7 @@ class ApplicationController < ActionController::Base
end end
def set_tenant def set_tenant
ActsAsTenant.current_tenant = Wedding.find_by(slug: params[:slug]) set_current_tenant(Wedding.find_by!(slug: params[:slug]))
end end
def development_swagger? def development_swagger?

View File

@ -0,0 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
ActsAsTenant.configure do |config|
config.require_tenant = !Rails.env.test?
end

View File

@ -2,12 +2,15 @@
NUMBER_OF_GUESTS = 50 NUMBER_OF_GUESTS = 50
TablesArrangement.delete_all ActsAsTenant.without_tenant do
Expense.delete_all TablesArrangement.delete_all
Guest.delete_all Expense.delete_all
Group.delete_all Guest.delete_all
Group.delete_all
Wedding.delete_all
end
Wedding.delete_all
wedding = Wedding.create!(slug: :default, date: 1.year.from_now) wedding = Wedding.create!(slug: :default, date: 1.year.from_now)
ActsAsTenant.with_tenant(wedding) do ActsAsTenant.with_tenant(wedding) do