-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
39f11fa
commit 79c0cb2
Showing
5 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,9 +26,11 @@ | |
can :create, Account | ||
can :update, Account if account.provider_can_use?(:service_permissions) | ||
|
||
# Using historical optimized way and leave canonical way commented out below | ||
# Using historical optimized permission and leave canonical way commented out below | ||
# The resulting hash presently is something like {"type"=>"Cinstance", "service_id"=>[ids..]} | ||
# Seems like canonically though that we are moving towards accessing service through plan | ||
# Seems like in general we are moving towards accessing service through plan. | ||
This comment has been minimized.
Sorry, something went wrong.
akostadinov
Author
Contributor
|
||
# Also this doesn't check account of the service but `member_permission_service_ids` will not | ||
# return foreign IDs. Also tenant_id checking should not allow foreign objects access. | ||
can %i[read show edit update], Cinstance, Cinstance.permitted_for(user).where_values_hash | ||
# can %i[read show edit update], Cinstance, user.accessible_cinstances do |cinstance| | ||
# cinstance.plan&.issuer_type == "Service" && cinstance.plan.issuer.account == user.account && | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'test_helper' | ||
|
||
module Tasks | ||
module Multitenant | ||
class TenantsIntegrityTest < ActiveSupport::TestCase | ||
test "reports tenant lack of integrity with has_many associations" do | ||
provider = FactoryBot.create(:simple_provider) | ||
buyers_to_update = FactoryBot.create_list(:simple_buyer, 2, provider_account: provider, tenant_id: provider.id + 1) | ||
buyer_not_to_update = FactoryBot.create(:simple_buyer, provider_account: provider, tenant_id: provider.id) | ||
|
||
execute_rake_task 'multitenant/tenants.rake', 'multitenant:tenants:integrity' | ||
end | ||
end | ||
end | ||
end |
both lines work, which line is better?