-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow case-insensitive tenant names in ShellHost #12106
Comments
Yes, for example we create folders based on the tenant name, so we can't have But I understant that to retrieve a tenant we could do a case insensitive lookup, but we would need to ensure that we then use the Or as you suggested use normalized keys, maybe better to use Your helper looks good, yes not the best for perf but if it is not in a hot code path. For info you also have the
As Lombiq did you can also make a string extension allowing
|
@jtkech Are you okay with submitting a PR with this change? Or, are you apposing this change to the core code? |
For now I would prefer to just use an extension helper to get a tenant settings in a case insensitive way, but I will think about it ;) |
Yes, I already thought about this, in fact if it doesn't impact too much the perf, we could just define case insensitive dictionnaries.
If you want you can suggest a PR mentioning that we discussed about this, and will see what @sebastienros think about the perf impact. Then if we do it, we would not need anymore in some places to do an explicit case insensitive lookup. For example as I remember in the |
@jtkech great call on I’ll submit a PR tomorrow with this change and see if I can find where we check for duplicate in Tenants also. thank you |
Is your feature request related to a problem? Please describe.
In a mobile version, I created a page when a user can login to a specific tenant by providing the
tenant name
,username
,password
. To identify which tenant the user is trying to access I user_shellHost.TryGetSettings(tenantName, out settings)
which looks up the tenant by name. The issue here is if the user does not provide a case sensitive tenant name, theShellHost
does not find anything.Describe the solution you'd like
It would be helpful if user case insensitive to find tenants. We can easily achieve this by storing the tenant key as lowercase and when we get/remove the tenant we will also use lowercase so no matter what the value is, we treat it the same.
@jtkech is there an issue from making this change? I can push a PR if no issue with doing this.
For example the line [if (!_shellContexts.TryAdd(settings.Name, new ShellContext.PlaceHolder { Settings = settings }))] (
OrchardCore/src/OrchardCore/OrchardCore/Shell/ShellHost.cs
Line 197 in 51f0db7
if (!_shellContexts.TryAdd(settings.Name.ToLower(), new ShellContext.PlaceHolder { Settings = settings }))
Obviosly, we have to make the same change on
TryGetValue
andTryRemove
Describe alternatives you've considered
I did the following
The text was updated successfully, but these errors were encountered: