brockallen / BrockAllen.MembershipReboot

MembershipReboot is a user identity management and authentication library.
Other
742 stars 238 forks source link

Default Tenant Fix #576

Closed benleishman closed 9 years ago

benleishman commented 9 years ago

Fixed Configuration.MultiTenant to properly set the default tenant.

brockallen commented 9 years ago

What's the motivation for this? Can you provide some context.

It's a breaking change, you realize.

benleishman commented 9 years ago

Sorry first time using GitHub.

The Configuration.MultiTenant check is backward. It's preventing the default tenant from being applied. So when you try to add a user to an unspecified Tenant it fails because the default tenant is always null.

Fix is easy. Just changed the same line in 13 places:

// Issue: This says don't set default tenant variable if MultiTenant is true if (!Configuration.MultiTenant)

to

// Fix: If MultiTenant mode is true and tenant not specified then set it. if ((Configuration.MultiTenant) && (string.IsNullOrWhiteSpace(tenant)))

benleishman commented 9 years ago

Just realized I have it wrong. The "default" tenant isn't meant to be used in Multi-Tenant mode. It's to set the default for single-tenant mode. And in Multi-tenant mode specifying the tenant is required. Sorry I just misunderstood this feature. The code was correct as I understand it now. I'll revert the commits.

brockallen commented 9 years ago

No problem.