Compare commits

...

2 Commits

Author SHA1 Message Date
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 13 additions and 6 deletions

View File

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

View File

@ -0,0 +1,3 @@
ActsAsTenant.configure do |config|
config.require_tenant = true
end

View File

@ -2,12 +2,15 @@
NUMBER_OF_GUESTS = 50
TablesArrangement.delete_all
Expense.delete_all
Guest.delete_all
Group.delete_all
ActsAsTenant.without_tenant do
TablesArrangement.delete_all
Expense.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)
ActsAsTenant.with_tenant(wedding) do